Skip to content

Commit 4ef21a5

Browse files
committed
Adapt to modern Qt6 QML import path conventions
Let's adopt QTP0001 and move all per-application resources already under qrc:/qt/qml/AsteroidApp/.
1 parent 6e010d3 commit 4ef21a5

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

cmake/AsteroidCMakeSettings.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ if (NOT ASTEROID_SKIP_BUILD_SETTINGS)
3434
set(INSTALL_QML_IMPORT_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/qt${QT_VERSION_MAJOR}/qml"
3535
CACHE PATH "Custom QML import installation directory")
3636

37-
set(QT_MIN_VERSION "5.12.0")
37+
# Ensure availability of QTP0001 (https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html)
38+
set(QT_MIN_VERSION "6.5.0")
3839
endif()

src/app/AsteroidAppConfig.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ set(ASTEROID_MODULE_PATH "@PACKAGE_ASTEROID_MODULES_INSTALL_DIR@")
77

88
include("${CMAKE_CURRENT_LIST_DIR}/AsteroidAppTargets.cmake")
99
@PACKAGE_INCLUDE_QCHTARGETS@
10+
11+
qt_policy(SET QTP0001 NEW)

src/app/asteroidapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ namespace AsteroidApp {
108108
{
109109
QScopedPointer<QGuiApplication> app(AsteroidApp::application(argc, argv));
110110
QScopedPointer<QQuickView> view(AsteroidApp::createView());
111-
view->setSource(QUrl("qrc:/main.qml"));
111+
view->setSource(QUrl("qrc:/qt/qml/AsteroidApp/main.qml"));
112112
view->resize(app->primaryScreen()->size());
113113
view->show();
114114
return app->exec();

src/app/asteroidapp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace AsteroidApp {
4343
ASTEROIDAPP_EXPORT QGuiApplication *application(int &argc, char **argv);
4444
ASTEROIDAPP_EXPORT QQuickView *createView();
4545

46-
// Very simple interface: Uses "qrc:/main.qml" as QML entry point
46+
// Very simple interface: Uses "qrc:/qt/qml/AsteroidApp/main.qml" as QML entry point
4747
ASTEROIDAPP_EXPORT int main(int &argc, char **argv);
4848
};
4949

0 commit comments

Comments
 (0)