diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-11 15:42:02 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-18 12:12:30 +0100 |
commit | 7120859fdb34cb7d80a183f1a8327b88d0fa7e10 (patch) | |
tree | 4fcb8515de64ed93ebd80bd1ba66b4c268c6faae /examples/network/doc | |
parent | 87f7d2c6b076a4c275d4d14a1e099844c9eb4766 (diff) |
a11y: QComboBox: Reset all model connections when setting model
When setting the model either directly for the combobox
itself or for the combobox's view, disconnect from the model
signals and connect to them anew. Always set the model for the
view first before connecting the combobox's own slots to the model's
signals. Since slots are activated in the order in which they are
connected [1] and both of them are connected to the
QAbstractItemModel::rowsInserted signal, this ensures that the
QAbstractItemViewPrivate::rowsInserted/QListView::rowsInserted
slot will get activated before the QComboBoxPrivate::rowsInserted one.
(QAbstractItemView::setModel connects its slots to the model's signals.)
Activating these slots the other way around is problematic
as described in more detail in
ecef7046245f3adee9366d3543e4ed2a09f65735 and QTBUG-120121.
(macOS accessibility bridge depends on
QAbstractItemViewPrivate::rowsInserted to
update its table representation, which may be necessary
before activating other slots; ATs or platform a11y caches
may depend on correct event order.)
In a quick test, this commit fixes the QTBUG-119526 crash reliably
reproducible after 5093e517b924074ab6e63658c87237be315a17e6
even without the previous fix ecef7046245f3adee9366d3543e4ed2a09f65735
in place. However, leave that one in place, too, as
relying on the order in which the connected slots are called
is quite fragile (s. the discussion in the Gerrit change
for ecef7046245f3adee9366d3543e4ed2a09f65735).
[1] https://doc.qt.io/qt-6/qobject.html#connect
Fixes: QTBUG-120121
Task-number: QTBUG-119526
Pick-to: 6.7 6.6 6.5
Change-Id: If75fef661f7fcfc1e30e90ec851a2555cf25a65d
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'examples/network/doc')
0 files changed, 0 insertions, 0 deletions