Changeset 769 for trunk/src/gui/itemviews/qabstractitemview.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qabstractitemview.cpp
r651 r769 1541 1541 d->doDelayedItemsLayout(); // the size of the items will change 1542 1542 break; 1543 #ifdef QT_SOFTKEYS_ENABLED 1544 case QEvent::LanguageChange: 1545 d->doneSoftKey->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::DoneSoftKey)); 1546 break; 1547 #endif 1543 1548 default: 1544 1549 break; … … 1781 1786 if (edited) 1782 1787 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)) 1784 1792 emit activated(index); 1785 1793 } … … 2115 2123 QAbstractScrollArea::focusOutEvent(event); 2116 2124 d->viewport->update(); 2125 2126 #ifdef QT_SOFTKEYS_ENABLED 2127 if(!hasEditFocus()) 2128 removeAction(d->doneSoftKey); 2129 #endif 2117 2130 } 2118 2131 … … 2140 2153 setEditFocus(true); 2141 2154 #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); 2143 2161 #endif 2144 2162 return; … … 2156 2174 } 2157 2175 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; 2158 2196 default: 2159 2197 if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { … … 2241 2279 case Qt::Key_Up: 2242 2280 #ifdef QT_KEYPAD_NAVIGATION 2243 if (QApplication::keypadNavigationEnabled() ) {2281 if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { 2244 2282 event->accept(); // don't change focus 2245 2283 break; … … 2249 2287 case Qt::Key_Right: 2250 2288 #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 2253 2293 break; 2254 2294 } … … 2532 2572 QList<QEditorInfo>::iterator it = d->editors.begin(); 2533 2573 QWidgetList editorsToRelease; 2574 QWidgetList editorsToHide; 2534 2575 while (it != d->editors.end()) { 2535 2576 QModelIndex index = it->index; … … 2543 2584 delegate->updateEditorGeometry(editor, option, index); 2544 2585 } else { 2545 editor ->hide();2586 editorsToHide << editor; 2546 2587 } 2547 2588 ++it; … … 2552 2593 } 2553 2594 2554 //we release the editor outside of the loop because it might change the focus and try2595 //we hide and release the editor outside of the loop because it might change the focus and try 2555 2596 //to change the d->editors list. 2597 for (int i = 0; i < editorsToHide.count(); ++i) { 2598 editorsToHide.at(i)->hide(); 2599 } 2556 2600 for (int i = 0; i < editorsToRelease.count(); ++i) { 2557 2601 d->releaseEditor(editorsToRelease.at(i)); … … 3010 3054 return; 3011 3055 if (QWidget *oldWidget = indexWidget(index)) { 3056 d->persistent.remove(oldWidget); 3012 3057 d->removeEditor(oldWidget); 3013 3058 oldWidget->deleteLater();
Note:
See TracChangeset
for help on using the changeset viewer.