Changeset 561 for trunk/src/gui/itemviews/qabstractitemview_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/itemviews/qabstractitemview_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 62 62 #include "QtGui/qpainter.h" 63 63 #include "QtCore/qpair.h" 64 #include "QtCore/qtimer.h"65 #include "QtCore/qtimeline.h"66 64 #include "QtGui/qregion.h" 67 65 #include "QtCore/qdebug.h" 68 66 #include "QtGui/qpainter.h" 67 #include "QtCore/qbasictimer.h" 69 68 70 69 #ifndef QT_NO_ITEMVIEWS … … 87 86 88 87 }; 88 89 typedef QPair<QRect, QModelIndex> QItemViewPaintPair; 90 typedef QList<QItemViewPaintPair> QItemViewPaintPairs; 89 91 90 92 class QEmptyModel : public QAbstractItemModel … … 100 102 }; 101 103 102 class Q_ GUI_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate104 class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate 103 105 { 104 106 Q_DECLARE_PUBLIC(QAbstractItemView) … … 110 112 void init(); 111 113 112 void _q_rowsRemoved(const QModelIndex &parent, int start, int end); 113 void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); 114 void _q_columnsRemoved(const QModelIndex &parent, int start, int end); 115 void _q_columnsInserted(const QModelIndex &parent, int start, int end); 116 void _q_modelDestroyed(); 117 void _q_layoutChanged(); 118 void _q_fetchMore(); 114 virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end); 115 virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); 116 virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end); 117 virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end); 118 virtual void _q_modelDestroyed(); 119 virtual void _q_layoutChanged(); 120 void _q_headerDataChanged() { doDelayedItemsLayout(); } 121 122 void fetchMore(); 119 123 120 124 bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const; … … 123 127 void doDelayedItemsLayout(int delay = 0); 124 128 void interruptDelayedItemsLayout() const; 129 130 void startAutoScroll() 131 { // ### it would be nice to make this into a style hint one day 132 int scrollInterval = (verticalScrollMode == QAbstractItemView::ScrollPerItem) ? 150 : 50; 133 autoScrollTimer.start(scrollInterval, q_func()); 134 autoScrollCount = 0; 135 } 136 void stopAutoScroll() { autoScrollTimer.stop(); autoScrollCount = 0;} 137 125 138 126 139 bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index); … … 140 153 virtual void selectAll(QItemSelectionModel::SelectionFlags command); 141 154 155 void setHoverIndex(const QPersistentModelIndex &index); 156 157 void checkMouseMove(const QPersistentModelIndex &index); 158 inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); } 159 142 160 inline QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const 143 161 { … … 150 168 151 169 #ifndef QT_NO_DRAGANDDROP 152 QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; 170 virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; 171 153 172 inline bool canDecode(QDropEvent *e) const { 154 173 QStringList modelTypes = model->mimeTypes(); … … 174 193 } 175 194 } 195 176 196 #endif 197 virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; 177 198 178 199 inline void releaseEditor(QWidget *editor) const { … … 219 240 void checkPersistentEditorFocus(); 220 241 221 QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r = 0) const;242 QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const; 222 243 223 244 inline QPoint offset() const { … … 299 320 return ref; 300 321 } 301 322 302 323 /** 303 324 * return true if the index is registered as a QPersistentModelIndex … … 305 326 inline bool isPersistent(const QModelIndex &index) const 306 327 { 307 return static_cast<QAbstractItemModelPrivate *>(model->d_ptr )->persistent.indexes.contains(index);328 return static_cast<QAbstractItemModelPrivate *>(model->d_ptr.data())->persistent.indexes.contains(index); 308 329 } 309 330 … … 311 332 312 333 QStyleOptionViewItemV4 viewOptionsV4() const; 334 335 void doDelayedReset() 336 { 337 //we delay the reset of the timer because some views (QTableView) 338 //with headers can't handle the fact that the model has been destroyed 339 //all _q_modelDestroyed slots must have been called 340 if (!delayedReset.isActive()) 341 delayedReset.start(0, q_func()); 342 } 313 343 314 344 QAbstractItemModel *model; … … 317 347 QMap<int, QPointer<QAbstractItemDelegate> > columnDelegates; 318 348 QPointer<QItemSelectionModel> selectionModel; 349 QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag; 350 bool noSelectionOnMousePress; 319 351 320 352 QAbstractItemView::SelectionMode selectionMode; … … 330 362 QPoint pressedPosition; 331 363 bool pressedAlreadySelected; 332 333 //forces the next mouseMoveEvent to send the viewportEntered signal 364 365 //forces the next mouseMoveEvent to send the viewportEntered signal 334 366 //if the mouse is over the viewport and not over an item 335 367 bool viewportEnteredNeeded; … … 351 383 bool overwrite; 352 384 QAbstractItemView::DropIndicatorPosition dropIndicatorPosition; 385 Qt::DropAction defaultDropAction; 386 #endif 387 388 #ifdef QT_SOFTKEYS_ENABLED 389 QAction *doneSoftKey; 353 390 #endif 354 391 … … 360 397 int autoScrollMargin; 361 398 int autoScrollCount; 399 bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event 400 bool shouldClearStatusTip; //if there is a statustip currently shown that need to be cleared when leaving. 362 401 363 402 bool alternatingColors; … … 372 411 QBasicTimer delayedEditing; 373 412 QBasicTimer delayedAutoScroll; //used when an item is clicked 374 Q TimeLine timeline;413 QBasicTimer delayedReset; 375 414 376 415 QAbstractItemView::ScrollMode verticalScrollMode; … … 384 423 private: 385 424 mutable QBasicTimer delayedLayout; 425 mutable QBasicTimer fetchMoreTimer; 386 426 }; 387 427
Note:
See TracChangeset
for help on using the changeset viewer.