Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qml caching problem



  • I'm facing for the first time a weird problem. I added to my project a new resource file, called qml. Here how my pro file looks like:

    QT += core gui widgets sql serialbus svg network printsupport qml quickwidgets quick
    TARGET = MyProject
    TEMPLATE = app
    DESTDIR = bin
    CONFIG += c++11
    DEFINES += QT_DEPRECATED_WARNINGS
    
    SOURCES += \
            main.cpp \
            mainwindow.cpp \
            ...
    
    HEADERS += \
            mainwindow.h \
            ...
    
    FORMS += \
            mainwindow.ui \
            ...
    
    TRANSLATIONS = languages/translation_en.ts  languages/translation_it.ts
    
    RESOURCES += \
        qdarkstyle/style.qrc \
        resources.qrc \
        qml.qrc
    

    when I'm in debug mode, I see all the three resource files with all their contents. But when I switch to the release mode the qml.qrc file disappear, a new qml_qmlcache.qrc is shown. This contains a different file that is not available (?) and cannot be removed. I tried to clean, run qmake and rebuild but the behavior doesn't change.

    What can be trigger such a behavior? How to fix it?


  • Lifetime Qt Champion

    Hi,

    What if you change that .qrc file name to something else ?



  • @SGaist said in qml caching problem:

    What if you change that .qrc file name to something else ?

    In debug mode, renamed to foo.qrc (it contains about 25 files).
    Switched to release, it was replaced by foo_qmlcache.qrc with only 1 file.


  • Lifetime Qt Champion

    Might be the QtQuick compiler kicking in.



  • @SGaist said in qml caching problem:

    Might be the QtQuick compiler kicking in.

    mmm, I didn't add qtquickcompiler to CONFIG . Would you please explain a bit more what should I do to avoid that?


  • Lifetime Qt Champion

    Check the content of the CONFIG variable and try CONFIG -= qtquickcompiler



  • @SGaist said in qml caching problem:

    Check the content of the CONFIG variable and try CONFIG -= qtquickcompiler

    Ok, I didn't understand from the docs that the option is enabled by default!
    After disabling it, it created a new qml_qmlcache.qrc file (without override the original) and it seems to work in both debug and release mode.


Log in to reply