From 07cef9df8bc5015ffd0050b000cfbe61c4fc414b Mon Sep 17 00:00:00 2001 From: Adrien <adrien.leblond54@orange.fr> Date: Mon, 17 Mar 2025 11:46:49 +0100 Subject: [PATCH] commit initial --- .gitignore | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 22 +++++++++++++++++++++ main.qml | 31 +++++++++++++++++++++++++++++ tutoGitQt.pro | 19 ++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 .gitignore create mode 100644 main.cpp create mode 100644 main.qml create mode 100644 tutoGitQt.pro diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de6e207 --- /dev/null +++ b/.gitignore @@ -0,0 +1,54 @@ +# C++ objects and libs +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.so.* +*.dll +*.dylib + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* +*.qm +*.prl + +# Qt unit tests +target_wrapper.* + +# QtCreator +*.autosave + +# QtCreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCreator CMake +CMakeLists.txt.user* + +# QtCreator 4.8< compilation database +compile_commands.json + +# QtCreator local machine specific files for imported projects +*creator.user* + +*_qmlcache.qrc \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..abe8cb4 --- /dev/null +++ b/main.cpp @@ -0,0 +1,22 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/tutoGitQt/main.qml")); + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreated, + &app, + [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, + Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..a1a2c70 --- /dev/null +++ b/main.qml @@ -0,0 +1,31 @@ +import QtQuick + +Window { + id: window + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + Rectangle { + id: rectangle + width: 300 + height: 200 + color: "#ffffff" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + + TextInput { + id: textInput + width: 80 + height: 20 + text: qsTr("Text Input") + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.bold: true + anchors.horizontalCenter: parent.horizontalCenter + } + } +} diff --git a/tutoGitQt.pro b/tutoGitQt.pro new file mode 100644 index 0000000..4d6fa73 --- /dev/null +++ b/tutoGitQt.pro @@ -0,0 +1,19 @@ +QT += quick + +SOURCES += \ + main.cpp + +resources.files = main.qml +resources.prefix = /$${TARGET} +RESOURCES += resources + +# 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 -- GitLab