Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.3, 6.6.0 RC
-
ad01abe1a (dev), 5f860b786 (6.6), a83503392 (tqtc/lts-6.5)
Description
QTBUG-104373 was fixed for general QML_ELEMENT but not for QML_SINGLETON. See attached project.
Code
mytype.h
class MyType : public QObject { Q_OBJECT QML_ELEMENT public: explicit MyType(QObject *parent = nullptr) : QObject(parent) {} Q_INVOKABLE QString name() const { return u"Foo"_qs; } }; class MySingleton : public QObject { Q_OBJECT QML_ELEMENT QML_SINGLETON public: explicit MySingleton(QObject *parent = nullptr) : QObject(parent) {} Q_INVOKABLE QString name() const { return u"Bar"_qs; } };
Main.qml
import QtQuick import Version0 Window { width: 640 height: 480 visible: true MyType { id: cppObj } Component.onCompleted: { console.log(cppObj.name()) console.log(MySingleton.name()) } }
Expected output (Version == 1.0)
qml: Foo qml: Bar
Actual output (Version == 0.1)
qml: Foo qrc:/qt/qml/Version0/Main.qml:13: ReferenceError: MySingleton is not defined
Attachments
Issue Links
- relates to
-
QTBUG-104373 [REG: 6.2->6.3] qt_add_qml_module does not register QML_ELEMENT classes if version starts with 0
- Closed
For Gerrit Dashboard: QTBUG-117958 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
516552,5 | Consider the major version when registering singletons | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
517415,2 | Consider the major version when registering singletons | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
517664,2 | Consider the major version when registering singletons | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |