D
D
Deerenaros2017-01-27 18:18:55
QML
Deerenaros, 2017-01-27 18:18:55

QtCreator + QML: does not update resource files on (re)build. Shaw to do?

Good day.
Actually, for two weeks now I have been making love with Qt + QML, in general, an amazing thing, everything you need is there and even more, besides cross-platform (a critical criterion, you need an android), but that's bad luck. It just so happened that I got used to vim or Visual Studio (the best IDE for today). But QtCreator is a thing in itself, it seems that everything is there, what is needed, but it seems that a piece of it is understandable. Actually, the problem is in the question, and the problem is amazing, it floats!
So, we create a couple of files in QRC. We change them. We collect, we launch. We change again. We collect, we launch. There is a difference? That's bad luck, it doesn't matter!
It's so annoying that it's just annoying. Googling resulted in two tickets on the bugboard , but they are closed. Actually, okay, if there is no right solution, I'm interested in the possibility of a quick solution. After all, now to run it, you must first run qmake, then make clean, and then make build. And only then launch. Actually, I would work under vim and rivet my own scripts, but no, you have to rape windows, and under it vim is not vim, scripts are not scripts and there are no terminals at all, so there is nothing to do here, but you have to. No matter how I searched, I didn’t find pre-build hooks in Qt to force qmake to be pushed there, but it would be ideal to fix this bug after all.
Remarkably, for quite a long time everything was ok.
The profile is here.

QT += charts qml quick serialport network

SOURCES += main.cpp \
    devicesmodel.cpp \
    device.cpp

RESOURCES += \
    qml.qrc

HEADERS += \
    devicesmodel.h \
    device.h \
    betterdebug.h

DISTFILES += Amplifier.qml \
    DevicesList.qml \
    DevicesView.qml \
    FDR.qml \
    main.qml \
    NLD.qml \
    OffMode.qml \
    Oscilloscope.qml \
    Receiver.qml \
    Settings.qml \
    Switcher.qml \
    SwitchItem.qml

One thing was all right, then everything got bad, it was fixed by forcibly adding all qml to DISTFILES. And then it's bad again. Quite tired.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deerenaros, 2017-01-30
@Deerenaros

Alexey used the solution , because it gets rid of the poor makefile, giving the greatest control over the project. Not everything works perfectly yet, but now it can work quite well. By the way, Qt already knows how to create QBS projects, although for this you will have to choose an illogical project without Qt.
To use Qt, you will need to add its module and the necessary submodules as dependencies, an example * .qbs file is just below:

import qbs

CppApplication {
    files: [
        "include/betterdebug.h",
        "include/device.h",
        "include/devicesmodel.h",
        "main.cpp",
        "qml.qrc",
        "resources/Amplifier.qml",
        "resources/DeviceView.qml",
        "resources/DevicesList.qml",
        "resources/FDR.qml",
        "resources/NLD.qml",
        "resources/OffMode.qml",
        "resources/Oscilloscope.qml",
        "resources/Receiver.qml",
        "resources/Settings.qml",
        "resources/SwitchItem.qml",
        "resources/Switcher.qml",
        "resources/main.qml",
        "source/device.cpp",
        "source/devicesmodel.cpp",
    ]

    Depends {
        name: "Qt"
        submodules: ["charts", "qml", "quick", "serialport", "network"]
    }

    Depends {
        name: "cpp"
    }

    Group {
        fileTagsFilter: product.type
        qbs.install: true
    }

    cpp.includePaths: ["./include"]
}

In general, this is an amazing thing, I hope for further development. In this regard, we got the most pleasant assembly at the Visual Studio level, but at the same time with full control and a QML language in which you can Turing complete JavaScript without any tricks. More information can be found here
. Thanks to Yakov E and Aleksey for their help.

J
Jacob E, 2017-01-27
@Zifix

Stop stop. In order for qrc changes to appear, you sometimes need to bother only after adding new files, with changes inside files - usually you don’t need to do anything. If, when updating the resource file, in some exceptional cases it does not rebuild itself, it is enough to remove the cpp file from the build directory and everything will be fine again.
Well, as for crutches, Google has as many of them as you like, in two weeks you could already find stackoverflow.com/questions/12873437/force-qtcreat...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question