Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
6.8
-
None
Description
Resulted from https://codereview.qt-project.org/c/qt/qtbase/+/583367
Consider the enum definition with underlying type uint32:
enum PositioningMethod {
NoPositioningMethods = 0x00000000,
SatellitePositioningMethods = 0x000000ff,
NonSatellitePositioningMethods = 0xffffff00,
AllPositioningMethods = 0xffffffff
};
Q_DECLARE_FLAGS(PositioningMethods, PositioningMethod)
// qml ... property int a: PositioningMethod.NonSatellitePositioningMethods property enumtype b: a console.log("bound to int",a); // Prints -256 console.log("enum", PositionSource.NonSatellitePositioningMethods); // Prints -256 console.log("bound to Enum", b); // Prints -256
If https://codereview.qt-project.org/c/qt/qtbase/+/581748 is in, binding to enum type gets the correct assignment, which is :
console.log("bound to Enum", b); // Prints 4294967040
Since the enum originally defined as unsigned int, the expected values indeed shouldn't have been -256. Investigate why flag-type enums creates inconsistencies and changes data type in Qml world
Attachments
Issue Links
- resulted from
-
QTBUG-128122 FAIL! : declarative_positioning_core::PositionSource::test_bindPositionSourceProperties() Compared values are not the same
-
- Closed
-