Changeset 846 for trunk/src/gui/itemviews/qabstractitemview.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qabstractitemview.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 105 105 currentIndexSet(false), 106 106 wrapItemText(false), 107 delayedPendingLayout(false) 108 { 107 delayedPendingLayout(true), 108 moveCursorUpdatedView(false) 109 { 110 keyboardInputTime.invalidate(); 109 111 } 110 112 … … 131 133 132 134 viewport->setBackgroundRole(QPalette::Base); 133 134 doDelayedItemsLayout();135 135 136 136 q->setAttribute(Qt::WA_InputMethodEnabled); … … 596 596 QAbstractItemView::~QAbstractItemView() 597 597 { 598 Q_D(QAbstractItemView); 599 // stop these timers here before ~QObject 600 d->delayedReset.stop(); 601 d->updateTimer.stop(); 602 d->delayedEditing.stop(); 603 d->delayedAutoScroll.stop(); 604 d->autoScrollTimer.stop(); 605 d->delayedLayout.stop(); 606 d->fetchMoreTimer.stop(); 598 607 } 599 608 … … 680 689 connect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); 681 690 } 682 setSelectionModel(new QItemSelectionModel(d->model, this)); 691 692 QItemSelectionModel *selection_model = new QItemSelectionModel(d->model, this); 693 connect(d->model, SIGNAL(destroyed()), selection_model, SLOT(deleteLater())); 694 setSelectionModel(selection_model); 695 683 696 reset(); // kill editors, set new root and do layout 684 697 } … … 824 837 825 838 \note If a delegate has been assigned to both a row and a column, the row 826 delegate (i.e., this delegate) will take pre sedence and manage the839 delegate (i.e., this delegate) will take precedence and manage the 827 840 intersecting cell index. 828 841 … … 882 895 883 896 \note If a delegate has been assigned to both a row and a column, the row 884 delegate will take pre sedence and manage the intersecting cell index.897 delegate will take precedence and manage the intersecting cell index. 885 898 886 899 \warning You should not share the same instance of a delegate between views. … … 1163 1176 \brief how the view scrolls its contents in the vertical direction 1164 1177 1165 This property control ls how the view scroll its contents vertically.1178 This property controls how the view scroll its contents vertically. 1166 1179 Scrolling can be done either per pixel or per item. 1167 1180 */ … … 1189 1202 \brief how the view scrolls its contents in the horizontal direction 1190 1203 1191 This property control ls how the view scroll its contents horizontally.1204 This property controls how the view scroll its contents horizontally. 1192 1205 Scrolling can be done either per pixel or per item. 1193 1206 */ … … 1272 1285 \brief the size of the area when auto scrolling is triggered 1273 1286 1274 This property control ls the size of the area at the edge of the viewport that1287 This property controls the size of the area at the edge of the viewport that 1275 1288 triggers autoscrolling. The default value is 16 pixels. 1276 1289 */ … … 1360 1373 Note that the model used needs to provide support for drag and drop operations. 1361 1374 1362 \sa setDragDropMode() {Using Drag and Drop with Item Views}1375 \sa setDragDropMode() {Using drag and drop with item views} 1363 1376 */ 1364 1377 … … 2094 2107 d->autoScroll = false; 2095 2108 QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index 2096 if (index.isValid() && d->isIndexEnabled(index) )2109 if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) 2097 2110 selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); 2098 2111 d->autoScroll = autoScroll; … … 2214 2227 2215 2228 QPersistentModelIndex newCurrent; 2229 d->moveCursorUpdatedView = false; 2216 2230 switch (event->key()) { 2217 2231 case Qt::Key_Down: … … 2266 2280 d->selectionModel->setCurrentIndex(newCurrent, command); 2267 2281 d->pressedPosition = visualRect(newCurrent).center() + d->offset(); 2268 // We copy the same behaviour as for mousePressEvent(). 2269 QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); 2270 setSelection(rect, command); 2282 if (newCurrent.isValid()) { 2283 // We copy the same behaviour as for mousePressEvent(). 2284 QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); 2285 setSelection(rect, command); 2286 } 2271 2287 } 2288 event->accept(); 2272 2289 return; 2273 2290 } … … 2301 2318 case Qt::Key_Shift: 2302 2319 case Qt::Key_Control: 2320 case Qt::Key_Delete: 2321 case Qt::Key_Backspace: 2303 2322 event->ignore(); 2304 2323 break; … … 2365 2384 break; } 2366 2385 } 2386 if (d->moveCursorUpdatedView) 2387 event->accept(); 2367 2388 } 2368 2389 … … 2841 2862 QModelIndex start = currentIndex().isValid() ? currentIndex() 2842 2863 : d->model->index(0, 0, d->root); 2843 QTime now(QTime::currentTime());2844 2864 bool skipRow = false; 2845 if (search.isEmpty() 2846 || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { 2865 bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); 2866 qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); 2867 if (search.isEmpty() || !keyboardTimeWasValid 2868 || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { 2847 2869 d->keyboardInput = search; 2848 2870 skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0) … … 2850 2872 d->keyboardInput += search; 2851 2873 } 2852 d->keyboardInputTime = now;2853 2874 2854 2875 // special case for searches with same key like 'aaaaa'
Note:
See TracChangeset
for help on using the changeset viewer.