Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/itemviews/qabstractitemview.cpp

    r651 r769  
    15411541        d->doDelayedItemsLayout(); // the size of the items will change
    15421542        break;
     1543#ifdef QT_SOFTKEYS_ENABLED
     1544    case QEvent::LanguageChange:
     1545        d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey));
     1546        break;
     1547#endif
    15431548    default:
    15441549        break;
     
    17811786        if (edited)
    17821787            return;
    1783         if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
     1788        QStyleOptionViewItemV4 option = d->viewOptionsV4();
     1789        if (d->pressedAlreadySelected)
     1790            option.state |= QStyle::State_Selected;
     1791        if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
    17841792            emit activated(index);
    17851793    }
     
    21152123    QAbstractScrollArea::focusOutEvent(event);
    21162124    d->viewport->update();
     2125
     2126#ifdef QT_SOFTKEYS_ENABLED
     2127    if(!hasEditFocus())
     2128        removeAction(d->doneSoftKey);
     2129#endif
    21172130}
    21182131
     
    21402153                setEditFocus(true);
    21412154#ifdef QT_SOFTKEYS_ENABLED
    2142                 addAction(d->doneSoftKey);
     2155                // If we can't keypad navigate to any direction, there is no sense to add
     2156                // "Done" softkey, since it basically does nothing when there is
     2157                // only one widget in screen
     2158                if(QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
     2159                        || QWidgetPrivate::canKeypadNavigate(Qt::Vertical))
     2160                    addAction(d->doneSoftKey);
    21432161#endif
    21442162                return;
     
    21562174        }
    21572175        return;
     2176    case Qt::Key_Down:
     2177    case Qt::Key_Up:
     2178        // Let's ignore vertical navigation events, only if there is no other widget
     2179        // what can take the focus in vertical direction. This means widget can handle navigation events
     2180        // even the widget don't have edit focus, and there is no other widget in requested direction.
     2181        if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
     2182                && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) {
     2183            event->ignore();
     2184            return;
     2185        }
     2186        break;
     2187    case Qt::Key_Left:
     2188    case Qt::Key_Right:
     2189        // Similar logic as in up and down events
     2190        if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
     2191                && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) {
     2192            event->ignore();
     2193            return;
     2194        }
     2195        break;
    21582196    default:
    21592197        if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
     
    22412279    case Qt::Key_Up:
    22422280#ifdef QT_KEYPAD_NAVIGATION
    2243         if (QApplication::keypadNavigationEnabled()) {
     2281        if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) {
    22442282            event->accept(); // don't change focus
    22452283            break;
     
    22492287    case Qt::Key_Right:
    22502288#ifdef QT_KEYPAD_NAVIGATION
    2251         if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
    2252             event->accept(); // don't change horizontal focus in directional mode
     2289        if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional
     2290                && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal)
     2291                || (QWidgetPrivate::inTabWidget(this) && d->model->columnCount(d->root) > 1))) {
     2292            event->accept(); // don't change focus
    22532293            break;
    22542294        }
     
    25322572    QList<QEditorInfo>::iterator it = d->editors.begin();
    25332573    QWidgetList editorsToRelease;
     2574    QWidgetList editorsToHide;
    25342575    while (it != d->editors.end()) {
    25352576        QModelIndex index = it->index;
     
    25432584                    delegate->updateEditorGeometry(editor, option, index);
    25442585            } else {
    2545                 editor->hide();
     2586                editorsToHide << editor;
    25462587            }
    25472588            ++it;
     
    25522593    }
    25532594
    2554     //we release the editor outside of the loop because it might change the focus and try
     2595    //we hide and release the editor outside of the loop because it might change the focus and try
    25552596    //to change the d->editors list.
     2597    for (int i = 0; i < editorsToHide.count(); ++i) {
     2598        editorsToHide.at(i)->hide();
     2599    }
    25562600    for (int i = 0; i < editorsToRelease.count(); ++i) {
    25572601        d->releaseEditor(editorsToRelease.at(i));
     
    30103054        return;
    30113055    if (QWidget *oldWidget = indexWidget(index)) {
     3056        d->persistent.remove(oldWidget);
    30123057        d->removeEditor(oldWidget);
    30133058        oldWidget->deleteLater();
Note: See TracChangeset for help on using the changeset viewer.