Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.3.2, 6.4.3, 6.5.0, 6.5.1
-
-
f7930126a (dev), 50e661d3b (6.6), 9be1da763 (6.5)
Description
Actually noticed this while writing another bugreport:
I have a simple use case for flags in qml:
class ControlFlags : public QObject { Q_OBJECT QML_ELEMENT QML_UNCREATABLE("Flag Container Class") public: ControlFlags() = delete; enum Option { ControlA = 0x1, ControlB = 0x2, Both = ControlA | ControlB } Q_DECLARE_FLAGS(Options, Option) Q_FLAG(Option) }; Q_DECLARE_OPERATORS_FOR_FLAGS(ControlFlags::Options)
using this in qml is fine up to the point, where we use Both. Both is available in qt creator and has meta information generated, but accessing it always gives -1.
So in qml, writing ControlFlags.ControlA | ControlFlags.ControlB != ControlFlags.Both.
In my use case, I have a component, which has flags as required property, when I use it like this:
Item { requiredFlags: ControlFlags.Both }
I get an invalid configuration back
Attachments
For Gerrit Dashboard: QTBUG-114326 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
487440,4 | qml compiler: Detect if user confuses flags and enums | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
488571,2 | qml compiler: Detect if user confuses flags and enums | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
488572,3 | qml compiler: Detect if user confuses flags and enums | 6.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |