Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.0
-
d00c76171de0c76794eb70a7284326332c0b3c66 (qt/qtdeclarative/dev) 159dfd19a742276a1f8f610d46a2a3e2ed3d99f6 (qt/qtdeclarative/6.2)
Description
I have a DelegateChooser als delegate and as roleValue I am using enums.
As model I use a QAbstractItemModel and return QVariant::fromValue(enumValue); which the DelegateChooser should switch on. (see attached example project)
In Qt 5.15 it is working fine, but in Qt 6 it doesn't show any delegates.
Changing the enum class to a unscoped enum doesn't change anything either.
if I return the enum as an int (via cast and/or by changing it to unscoped enum) it works again.
In QQmlDelegateChoice::match:
- m_value: QVariant(int, 0)
- value: QVariant(TestModel::Type, "Info")
Due to the recent QVariant changes this comparison always fails because they are different types. Perhaps QVariant should make an exception for enums?
Attachments
Issue Links
- is duplicated by
-
QTBUG-97488 [REG 5.15.2->6.2] DelegateChooser not finding choice
- Closed
For Gerrit Dashboard: QTBUG-86202 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
377197,4 | Let DelegateChoice.roleValue compare enum as string, enum or int | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
379172,2 | Let DelegateChoice.roleValue compare enum as string, enum or int | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |