Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
5.15.2
Description
For such C++ code:
class Foo : public QObject { Q_OBJECT Q_PROPERTY(Boo::NamespaceE v1 MEMBER v1_ FINAL) Q_PROPERTY(Moo::NamespaceE v2 MEMBER v2_ FINAL) public: explicit Foo(QObject *parent = nullptr); private: Boo::NamespaceE v1_ = Boo::NamespaceE::Magnetic; Moo::NamespaceE v2_ = Moo::NamespaceE::Magnetic; };
and QML code:
import QtQuick 2.15 import QtQuick.Window 2.15 import Cpp 1.0 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Foo { id: foo } Component.onCompleted: { console.log("typeof v1", typeof(foo.v1)); console.log("typeof v2", typeof(foo.v2)); } }
qml engine prints:
qml: typeof v1 number qml: typeof v2 object
Files where defined Boo and Moo namespaces are completely identical (
if replace Boo with Moo or vise versa).
The only difference that "boo.h" defined inside source tree where "moo.hpp" is generated during code build. The full project (CMakeLists.txt and all sources) attached as zip archive.
The interesting part that if I move moo.hpp from ${CMAKE_CURRENT_BINARY_DIR}/gen-code to ${CMAKE_CURRENT_BINARY_DIR} all works fine and qml engine prints "v2 number".
The moc_*.cpp files looks identical (excluding part where source files was including), so this should not be "moc" bug.