QML autocomplete / intellisense doesn't work for namespace enums
-
Hi all. Running Qt Creator 4.14.0 with a Qt 6.0.1 MSVC 2019 x64 toolchain.
I have a namespace containing multiple enums which I want to be accesible to my QML. This is easy enough as the following example demonstrates:
// testnamespace.h namespace TestNamespace { Q_NAMESPACE enum class TestEnum { TestEnum_option1, TestEnum_option2, TestEnum_option3 }; Q_ENUMS(TestEnum) }
// main.cpp int main(int argc, char *argv[]) { qmlRegisterUncreatableMetaObject(TestNamespace::staticMetaObject, "My.Company", 1, 0, "TestNamespace", "Error: namespace not creatable"); ...
// main.qml import QtQuick 2.15 import QtQuick.Window 2.15 import My.Company 1.0 Window { width: 640 height: 480 visible: true title: TestNamespace.TestEnum_option3 }
The problem is that while it will autocomplete the namespace in the QML file, there is no autocomplete for any of the namespace enum values.
If instead the enum is placed into a QObject derived class and the class type is registered in the same way using qmlRegisterType() then the QML editor provides autocomplete for the enum values, but I don't really see this as a good solution for a number of reasons.
So I guess the question is, is there any intent to resolve this in the future? Or is there a workaround that anyone knows of that can be used to get the autocomplete working for the namespace enum values?
-