Priority: P2: Important
Affects Version/s: 5.15.2, 6.0.0 RC2
Component/s: Core: Item Models
Commits:811a6c6b77a94d86e28a0b00079e02a863391108 (qt/qtbase/dev) 838b1d1b76abf8219e0177cb0c0e201c1917ca92 (qt/qtbase/6.1)
Given a populated QStandardItemModel, taking one of the QStandardItems out of it (via takeItem() on the model, or takeChild() on an item) does not cause the model to emit the right signals. It must, at a minimum, go through row deletion protocol (to signal that the children of the item are getting removed) and then emit a dataChanged for the index that got removed.
This makes QAIMT to correctly scream when pointed at a QSIM.
Fix is tricky, because depending on whether QSIM emits first dataChanged or the row removal, the "other" data must still be correct for a little while.
- If you do dataChanged first, then you must report dummy data (= equivalent to a default constructed QSI) while going through the row removal.
- If you do row removal first, then after rowRemoved the QSMI still has its children, but the model must not report them. It must however still report the old data for the item. Then the dataChanged() wipes the data out
I'd also suggest to document to never do structural modifications of the model from slots connected to QSIM signals, or it'll make QSIM super hard to implement correctly.
|For Gerrit Dashboard: QTBUG-89145|
|348840,1||Fix QStandardItemModel signals on takeChild||tqtc/lts-5.15||qt/tqtc-qtbase||Status: NEW||0||0|
|345585,9||Fix QStandardItemModel signals on takeChild||dev||qt/qtbase||Status: MERGED||+2||0|
|348837,2||Fix QStandardItemModel signals on takeChild||6.1||qt/qtbase||Status: MERGED||+2||0|