QML Projekt "Hello World"
-
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. -
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
-
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"
-
-
@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