enums, qml, qmake and rcc
-
Hallo!
I created a simple test project:
TestProject_Enums_Compat.proQT += quick SOURCES += \ main.cpp resources.files = main.qml resources.prefix = /$${TARGET} RESOURCES += resources # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target HEADERS += \ definitions.hThen i add an enum in a namespace:
definitions.h#include <QObject> namespace SETTINGS { Q_NAMESPACE enum EnumTest { VALUE_0, //VALUE_X, VALUE_1 }; Q_ENUM_NS(EnumTest) }I register it and start a qml app:
main.cpp#include <QGuiApplication> #include <QQmlApplicationEngine> #include "definitions.h" int main(int argc, char *argv[]) { qmlRegisterUncreatableMetaObject(SETTINGS::staticMetaObject, "Settings", 1, 0, "SETTINGS", QStringLiteral("SETTINGS should not be created in QML")); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/TestProject_Enums_Compat/main.qml")); QObject::connect( &engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }My qml code is also very simple:
main.qmlimport QtQuick import Settings 1.0 Window { width: 640 height: 480 visible: true title: qsTr("Enum Test Project") Component.onCompleted: console.debug("IS: " + value_1 + " SHOULD BE: " + SETTINGS.VALUE_1) property int value_1: SETTINGS.VALUE_1 }And here the bug:
When i change the enum, e.g. adding VALUE_X, i get the following output:
IS: 1 SHOULD BE: 2So, i made a clean rebuild: same output
I deleted the build folder: same output
I reset all project configurations: same output
I reset the qml code model: same output
I closed the project, closed QtCreator, deleted the build folder, i even rebooted my computer: same outputNote, i still use qmake.
It works as expected with cmake.
It works when i build the project with another Qt version.
It also works when i activate the Qt-Quick-Compiler.
And it works, when i overwrite main.qml (without making any changes).
But i still get the same output, when i copy all files to another folder!
You can see the complete content of all involved files above...So how can that be?
Does the rcc use some sort of cache?