diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-18 11:59:53 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-18 16:49:39 +0000 |
commit | 25255f7f37702adcf6890a880a067eb23c249fc1 (patch) | |
tree | fe986c1309aca01e2fe222db0f3161afae7ce141 /tests/auto/qml/qqmllanguage/testtypes.h | |
parent | ccb9c7995703949972f85ce311a5d16b2a43f4b4 (diff) |
Handle more potential underlying types
Since f3bcbfd6a50fb7e74f4ff6714d3b3066fa74e253, we use the underlying
type of an enum when the binding is detected as a resolved enum and
the property is of enum type.
When using an enums underlying type, we can receive types that were
formerly not possible, because we would normalize them to plain int.
Fix this by teaching the object creator to handle assignments of
signed and unsigned integer types.
Fixes: QTBUG-123428
Change-Id: I3635b7de048e0c6ddf79381679aafee89a5b3def
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 186405955f1057111379369fc43951513c461aa9)
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/testtypes.h')
-rw-r--r-- | tests/auto/qml/qqmllanguage/testtypes.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h index 568872fb4e..bbf328b9a7 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.h +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -1294,6 +1294,40 @@ public: } }; +class EnumPropsManyUnderlyingTypes : public QObject +{ + Q_OBJECT + QML_ELEMENT +public: + enum si8 : qint8 { ResolvedValue = 1}; + enum ui8 : quint8 {}; + enum si16 : qint16 {}; + enum ui16 : quint16 {}; + enum ui64 : qint64 {}; + enum si64 : quint64 {}; + Q_ENUM(si8) + Q_ENUM(ui8) + Q_ENUM(si16) + Q_ENUM(ui16) + Q_ENUM(si64) + Q_ENUM(ui64) + + + Q_PROPERTY(si8 si8prop MEMBER si8prop) + Q_PROPERTY(ui8 ui8prop MEMBER ui8prop) + Q_PROPERTY(si16 si16prop MEMBER si16prop) + Q_PROPERTY(ui16 ui16prop MEMBER ui16prop) + Q_PROPERTY(si64 si64prop MEMBER si64prop) + Q_PROPERTY(ui64 ui64prop MEMBER ui64prop) + + si8 si8prop = si8(0); + ui8 ui8prop = ui8(0); + si16 si16prop = si16(0); + ui16 ui16prop = ui16(0); + si64 si64prop = si64(0); + ui64 ui64prop = ui64(0); +}; + Q_DECLARE_METATYPE(MyEnum2Class::EnumB) Q_DECLARE_METATYPE(MyEnum1Class::EnumA) Q_DECLARE_METATYPE(Qt::TextFormat) |