Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
None
-
5.14.2
-
None
Description
I was trying to use DelegateChooser to show the current item in a ListView radically different than the not-current items, and DelegateChooser seemed to be the right choice for the task.
Using a setup like this:
ListView { id: view model: someModel delegate: chooser } DelegateChooser { id: chooser DelegateChoice {row: view.currentIndex; delegate: currentDelegate} DelegateChoice {/* default */; delegate: normalDelegate} } Component { id: normalDelegate // stuff, including setting view.currentIndex on clicking on it } Component { id: currentDelegate // very different stuff }
There is nothing in the documentation of DelegateChooser to suggest this should not work, but it doesn't.
Reading the source code of DelegateChooser and DelegateChoice, that is not all that suprising I guess. DelegateChoice has signals signalling changes, but it seems that DelegateChooser doesn't listen to these signals.
However, I also tried a work-around where I make the model emit a dataChanged signal for the affected rows in an attempt to force a re-evaluation of `QmlDelegateChoice::match`, but that also does not result in a change of delegate used for the items.
It seems that as it stands, DelegateChooser and DelegateChoice are only suitable for scenario's where both the criteria and the data are static, as no updates are processed.
Attachments
Issue Links
- is duplicated by
-
QTBUG-97579 When using DelegateChooser with a TreeView and then doing a sort on the model in a TreeView, the items are not correctly updated to reflect the chooser
- Closed
- is required for
-
QTBUG-98101 DelegateChooser / DelegateChoice: graduate from Qt.labs
- Closed