diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-12-08 12:06:20 +0100 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-12-12 22:14:56 +0100 |
commit | 734354c0bae543795222a47cca2a013352d49745 (patch) | |
tree | 39b5e601d0079f09105624768dfe9bceeb4c8659 /src/corelib/itemmodels/qabstractproxymodel_p.h | |
parent | 75a5605151d203fb4c2269001dddfd3db121ea2e (diff) |
QAbstractProxyModel: Emit headerDataChanged() signal with valid data
This amends commit a0bcad39033bddd9b9d14a524b829513105913d3.
Delayed signals emitted by the previous commit may have
invalid parameters if the source model was updated several
times before entering the event loop. This commit fixes that
by evaluating the section range immediately before emitting
the signal. This commit also ensures that the signal is
emitted only once after entering the event loop.
Fixes: QTBUG-119155
Pick-to: 6.6 6.5 6.7
Change-Id: I9e84703cca26fde8464a6b9a414bb7462cbb9abd
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractproxymodel_p.h')
-rw-r--r-- | src/corelib/itemmodels/qabstractproxymodel_p.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/itemmodels/qabstractproxymodel_p.h b/src/corelib/itemmodels/qabstractproxymodel_p.h index 70bc482ffd..d33666d00b 100644 --- a/src/corelib/itemmodels/qabstractproxymodel_p.h +++ b/src/corelib/itemmodels/qabstractproxymodel_p.h @@ -31,7 +31,9 @@ public: QAbstractProxyModelPrivate() : QAbstractItemModelPrivate(), sourceHadZeroRows(false), - sourceHadZeroColumns(false) + sourceHadZeroColumns(false), + updateVerticalHeader(false), + updateHorizontalHeader(false) {} void setModelForwarder(QAbstractItemModel *sourceModel) { @@ -58,8 +60,13 @@ public: void mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent, int *source_row, int *source_column, QModelIndex *source_parent) const; + void scheduleHeaderUpdate(Qt::Orientation orientation); + void emitHeaderDataChanged(); + unsigned int sourceHadZeroRows : 1; unsigned int sourceHadZeroColumns : 1; + unsigned int updateVerticalHeader : 1; + unsigned int updateHorizontalHeader : 1; }; QT_END_NAMESPACE |