Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.3.0 Beta2
-
-
cbb4aea21 (dev), 3092406d7 (6.7), a4817f47f (6.6), 17c9ad928 (tqtc/lts-6.5), 672a82463 (dev), 28a88b598 (6.7), bdb4663ee (6.6), b5266a1f2 (tqtc/lts-6.5)
Description
Moc takes the base class name of a Q_OBJECT'ed class as-is from the source code. Cf. Girl example of OP. This doesn't matter much for moc_.cpp, because the C++ compiler will perform name lookup, and thus find model::Person but in the moc_.cpp.json file, the scope is missing and tools using the JSON information either need to perform their own name lookup or fail to find the base class.
Since moc needs to know about the base class(es) of a moc'ed class, it seems weird that it wouldn't resolve base class names to FQN before storing them in the generated files.
Old description:
When using inheritance for namespaced classes that export QML related entities, the behaviour is a bit odd:
namespace model { class Person {...} class Boy : public model::Person { Q_OBJECT QML_NAMED_ELEMENT(Boy) public: Boy(QObject * parent = nullptr) : Person(parent) {} }; }
works fine, while
namespace model { class Person {...} class Girl : public Person { Q_OBJECT QML_ELEMENT public: Girl(QObject * parent = nullptr) : Person(parent) {} }; }
does not:
Warning: main.qml: Object type model::Girl is not derived from QObject or QQmlComponent Warning: main.qml:15:9: Could not compile binding for onCompleted: Type model::Girl of ??::bar with type model::Girl does not have a property shoeSize for writing bar.shoeSize = 123 ^^^
Attachments
Issue Links
- duplicates
-
QTBUG-114986 Qml's typeregistrar is not parsing namespaces correctly
- Closed
- relates to
-
QTBUG-124294 Unresolved type even it is listed
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-101141 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
525154,4 | qmltyperegistrar: prefer JSON's superClass.fullyQualifiedName | dev | qt/qtdeclarative | Status: NEW | +1 | 0 |