diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-01 14:39:30 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-09-01 14:41:31 (GMT) |
commit | efc616f2a1a83bd4ca50aea9d40a0df005ada063 (patch) | |
tree | c6dd80685a33c36156d2a5d50c4a4182b0b0309e /src/gui/itemviews/qabstractitemview_p.h | |
parent | 3dfde91fcbeaf304edd8d0d09e0732597055cd53 (diff) | |
download | Qt-efc616f2a1a83bd4ca50aea9d40a0df005ada063.zip Qt-efc616f2a1a83bd4ca50aea9d40a0df005ada063.tar.gz Qt-efc616f2a1a83bd4ca50aea9d40a0df005ada063.tar.bz2 |
QTreeView: exapnding nodes just after replacing the model wouldn't work
The problem is that deleting the previous model would triggera delayed
reset. This reset could happen after the model has changed and nodes
are expanded. We can now cancel a reset when reset is called from
another place (like when we set a new model).
Note: autotest included
Task-number: 245654
Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/itemviews/qabstractitemview_p.h')
-rw-r--r-- | src/gui/itemviews/qabstractitemview_p.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 4517941..434d644 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -328,6 +328,15 @@ public: QStyleOptionViewItemV4 viewOptionsV4() const; + void doDelayedReset() + { + //we delay the reset of the timer because some views (QTableView) + //with headers can't handle the fact that the model has been destroyed + //all _q_modelDestroyed slots must have been called + if (!delayedReset.isActive()) + delayedReset.start(0, q_func()); + } + QAbstractItemModel *model; QPointer<QAbstractItemDelegate> itemDelegate; QMap<int, QPointer<QAbstractItemDelegate> > rowDelegates; @@ -389,6 +398,7 @@ public: QBasicTimer updateTimer; QBasicTimer delayedEditing; QBasicTimer delayedAutoScroll; //used when an item is clicked + QBasicTimer delayedReset; QAbstractItemView::ScrollMode verticalScrollMode; QAbstractItemView::ScrollMode horizontalScrollMode; |