QT QML resource files are not recompiled after changes

I am using QT 5.9.1 while working on Mac OS. My project is a mobile application with C ++ logic and a UML QML layer. All QML files are included in the qml.qrc file, so there is in my .pro file

RESOURCES + = qml.qrc

Inside qml.qrc there is a list of all resource files that I use in Project, such as images, icons, and QML files, in QT Creator it displays OK:

List of source files

As you can see, some QML files are located in the ROOT qml.qrc path, while other files are in subfolders, for example. "QRC: / Elements /".

, , whenether , qml.qrc - , build, rebuild, clean build, . , qml_qrc.cpp( , cpp ), , , .

, cpp MainPage.qml.

/********************************************** ****************************** ** ** ** : Qt 5.9.1 ** ** ! , , ! ************************************************** ***************************/

static const unsigned char qt_resource_data [] = {// /Users/admin/QtProjects/LazuritApp -temp/MainPage.qml
0x0,0x0,0x7,0xd1, 0x0,
0x0,0x1e, 0xBB, 0x78,0x9c, 0xd5,0x19,0x5d, 0x6F, 0xdc, 0x36,0xf2,0x7d, 0x7F, 0x5,0x6f, 0xB, 0x14,0xbb, 0x69,0xa2,0xf5,0xae, 0xed, 0xa4,0xde, 0xa0,0x77,0xf0,0xba, 0x49,0x63, 0x20,0x45,0xda, 0xda, 0x68,0x1e, 0xE, 0x45,0xc1,0x95,0xa8,0x15,0x2f, 0x5a, 0x51,0xa5, 0x24,0xdb, 0x5b, 0xc3,0x40,0xda, 0x2,0xed, 0x1,0x79,0x28,0x70,0x68,0x71,0xcf, 0xf7, 0xf, 0xdc, 0xBB, 0x6b, 0x1b, 0x34,0x4d, 0xFA, 0x17,0xb4,0xff, 0xa8,0x43,0x52,0x5f, 0x94,

..............

, , qml_qrc.cpp , , , . " qmake" , . , - (, , qml_qrc.cpp). , "Build" qml_qrc.cpp, , , .

- , ? , ...

qml

qml_scenes.depends = $$ PWD/QML/OrdersPage.qml

qml_scenes.commands = QMAKE_EXTRA_TARGETS + = qml_scenes

,

+4
2

ok, QTBUGS , stackoverflow , - .

1) script ( .sh, MAS, Windows .bat) "touch" qml.qrc. 2 :

#!/Bin/

qml.qrc

2) (Projects- > Build Settings- > Build Steps- > Add Custom Process Step). .sh, , . ( qmake Make)

3) , qml . script qml.qrc, , qml.qrc(, qml ) makefile.

, , , ..

- , )

+3

, , , , / . :

update_qml.target = qml.qrc
update_qml.commands = echo>>$${update_qml.target} # same as touch
update_qml.depends = $$files(path/to/resource/files/*, true) # recurse into subdirs
QMAKE_EXTRA_TARGETS += update_qml
PRE_TARGETDEPS += $${update_qml.target}

, , , QMAKE_EXTRA_TARGETS Makefile:

qml.qrc: file1 file2 ...
        echo>>qml.qrc

, make qml.qrc qml.qrc . , , PRE_TARGETDEPS, :

$(DESTDIR_TARGET): qml.qrc $(OBJECTS) and other stuff ...
        $(LINKER) flags objects and other stuff ...

, make .

0

Source: https://habr.com/ru/post/1690838/


All Articles