Solved QML Projekt "Hello World"
-
Hallo Zusammen,
ich habe eine "hello World " in QML erstellt.
Wenn ich was ändere in diesem Projekt sind dann die Änderung nur in release Modus sichtbar in debug doch nicht.
Muss ich was einrichten bei der Projet Properte
Danke -
@Galilio
generell nein, sollte kein Unterschied zwischen debug und release sein. Was genau meinst, du? -
ich habe einfach einen QML "Qt Quick Application- Empty " erstellt.
Ich habe z.B dastitle: qsTr("Hello World")
zu
title: qsTr("dfjgkdfjghjdfg")
geändert.
Der Titel n Debug nach der Änderung ist immer gleich geblieben "Hello World"
In Release wurde aber geändert und das kapiere ich nicht. -
@Galilio
wenn du das QML File aus dem Ressourcen lädst und nicht direkt von der Festplatte, musst du vielleicht vorher nochmalqmake
ausführe.
Der Aufruf macht dann aus allen Ressourcen binary files die mit in die exe kopiert werden. Wenn man was an den Ressourcen ändert wird das nicht automatisch geupdated. -
@J-Hilk
Mit dem qmake ausführen meinst du, dass ich neu rebuilden muss? -
-
Die Option qmake ausführen habe ich nicht
-
Guten Morgen zusammen,
@J-Hilk
Hat das vielleicht mit Projekt Konfiguration zu tun? -
Bei der Applicaton Output habe ich folgende Meldung:
QML debugging is enabled. Only use this in a safe environment. QQmlComponent: Component is not ready qrc:///main.qml:60:5: QML StackView: initialItem: file://nas-ham-ch-001/user/xyayayay/Daten/build-Einfuehrung1-Desktop_Qt_5_9_1_MinGW_32bit-Debug/HomeForm.ui.qml:-1 No such file or directory qrc:///main.qml:28: TypeError: Cannot read property 'title' of null```
-
@Galilio
Wenn ich mein .pro datei öffne, die sieht dann so aus:QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
Fehlt was?
Danke
-
@J-Hilk
Guten Morgen
Sorry für die Störung
Kannst du mir bitte nicht weiter helfen.Danke
-
Wenn ich einen breakpoint in main.cpp setze, dann hält sich die App bei diesem breakpoint aber die Änderung auf QML seite werden nicht übernommen.
-
@Galilio
Vorschlag,da es ja anscheinend kein großes Projekt ist, warum postet du nicht den QuellCode von dem was du gemacht hast, und wir sehen was wir machen können.
-
Ich habe es einen QtQuick_Application_Scroll erstellt.
Das Projeckt ist schon erstellt.
Build lässt sich auch einwandfrei funktionieren.
Die Source code sehen dann so aus:
--> main.cpp#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
main.qml
import QtQuick 2.9 import QtQuick.Controls 2.2 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Scroll") ScrollView { anchors.fill: parent ListView { width: parent.width model: 20 delegate: ItemDelegate { text: "Item " + (index + 1) width: parent.width } } } }
das pro File sieht so aus:
QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
--> an dem main.qml ändere ich diese Zeile:
von: title: qsTr("Scroll") zu: title: qsTr("dfsdfjkhskdfhksjd")Ich starte das Projekt neu mit qmake "Debug"
Der Title des GUIs ist gleich geblieben "Scroll" stattt "dfsdfjkhskdfhksjd"
-
Wenn ich unter Build-Einstellung das Häckchen Qt Quick Compiler setze
und in der pro File folgenden einfüge:OTHER_FILES += main.qml
dann werden alle Änderungen, die auf QML Seite gemacht wurden direkt in Debug-Modus
sichtbarMuss ich immer so machen?
-
@J-Hilk
Problem hast sich gelöst.
Es lag daran, dass das Projekt auf dem Netzwerk lag.
Es scheint, dass Qt damit Probleme hat. -
@Galilio
danke für die Info. Auf dies, als die Fehlerursache, wär ich so ohne weiteres auch nicht gekommen.
Gut das du es gefunden hast.Viel Erfolg noch!
-
@J.Hilk
Was ich gemerkt habe ist, dass das Projektname nicht grosser als 128 zeichen sein darf.
Ist so der Fall, dann werden die Änderungen nicht sichtbar sein. -
@Galilio said in QML Projekt "Hello World":
Projektname nicht grosser als 128 zeichen sein darf
Projektname oder Pfad zum Project?
-
@Galilio said in QML Projekt "Hello World":
Was ich gemerkt habe ist, dass das Projektname nicht grosser als 128 zeichen sein darf.
128 ? das normale Limit für Windows/NTFS systeme ist 260