Details
-
User Story
-
Resolution: Done
-
P2: Important
-
None
-
None
Description
Qt 6.2 features a new CMake API to define projects using QML: qt_add_qml_module. We should support this new API in all Qt Quick wizards that support CMake.
This is also an opportunity to greatly simplify the wizard content, by relying
a) on Qt 6.2
b) on a recent CMake version (suggestion: 3.16)
Qt Quick Minimal Wizard
When selecting a 'Qt Quick App - empty' the minimal supported Qt version' dialog should feature "Qt 6.2" (can replace "Qt 6"). When selecting this, the file template should look like the following:
CMakeLists.txt
cmake_minimum_required(VERSION 3.16) project(myapp VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.2 COMPONENTS Quick REQUIRED) qt_add_executable(myapp main.cpp ) qt_add_qml_module(myapp URI myapp VERSION 1.0 QML_FILES main.qml ) target_compile_definitions(myapp PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(myapp PRIVATE Qt6::Quick)
main.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(u"qrc:/myapp/main.qml"_qs); 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(); }
main.qml
import QtQuick Window { width: 640 height: 480 visible: true title: qsTr("Hello World") }
Other wizards should be handled similarly.
Attachments
Issue Links
- replaces
-
QTCREATORBUG-24973 Qt Quick Wizards: Add proper support for Qt 6
- Withdrawn
- mentioned in
-
Page Loading...
For Gerrit Dashboard: QTCREATORBUG-26170 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
368761,7 | QtWizard: Create new project templates for Qt 6.2 | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |