diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2021-09-01 15:40:28 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-03 15:10:39 +0000 |
commit | ce546cdd8c0d8b5175af81e7cf7f06f9b56cfeed (patch) | |
tree | 5cbe853f922c8efc2d5cfea94a2cb7d45cc579ed /examples | |
parent | 3aea6644d47b82784b01b5268eda2fad8c28b5c9 (diff) |
Fix localstorage example to use a QML module
Removing the directory 'localstorage' that is inside the top-level
'localstorage' directory, and moving the content one level up in the
file hierarchy.
Change-Id: I97cf1ff92be9860d9a92bce66c88af927618e2b0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b0e567e7e3927945c904e9a613af4b9064d70bc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/localstorage/CMakeLists.txt | 46 | ||||
-rw-r--r-- | examples/quick/localstorage/Database.js (renamed from examples/quick/localstorage/localstorage/Database.js) | 0 | ||||
-rw-r--r-- | examples/quick/localstorage/Header.qml (renamed from examples/quick/localstorage/localstorage/Header.qml) | 0 | ||||
-rw-r--r-- | examples/quick/localstorage/MyDelegate.qml (renamed from examples/quick/localstorage/localstorage/MyDelegate.qml) | 0 | ||||
-rw-r--r-- | examples/quick/localstorage/MyModel.qml (renamed from examples/quick/localstorage/localstorage/MyModel.qml) | 0 | ||||
-rw-r--r-- | examples/quick/localstorage/localstorage.pro | 11 | ||||
-rw-r--r-- | examples/quick/localstorage/localstorage.qml (renamed from examples/quick/localstorage/localstorage/localstorage.qml) | 0 | ||||
-rw-r--r-- | examples/quick/localstorage/localstorage.qrc (renamed from examples/quick/localstorage/localstorage/localstorage.qrc) | 2 | ||||
-rw-r--r-- | examples/quick/localstorage/localstorage/CMakeLists.txt | 58 | ||||
-rw-r--r-- | examples/quick/localstorage/localstorage/localstorage.pro | 9 | ||||
-rw-r--r-- | examples/quick/localstorage/main.cpp (renamed from examples/quick/localstorage/localstorage/main.cpp) | 2 |
11 files changed, 56 insertions, 72 deletions
diff --git a/examples/quick/localstorage/CMakeLists.txt b/examples/quick/localstorage/CMakeLists.txt index 6a405efc81..1f5e60197b 100644 --- a/examples/quick/localstorage/CMakeLists.txt +++ b/examples/quick/localstorage/CMakeLists.txt @@ -1,3 +1,47 @@ # Generated from localstorage.pro. -qt_internal_add_example(localstorage) +cmake_minimum_required(VERSION 3.16) +project(localstorage LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/localstorage") + +find_package(Qt6 COMPONENTS Core Gui Quick Qml) + +qt_add_executable(localstorageexample + WIN32 + MACOSX_BUNDLE + main.cpp +) + +qt_add_qml_module(localstorageexample + URI localstorage + VERSION 1.0 + QML_FILES + "Database.js" + "Header.qml" + "MyDelegate.qml" + "MyModel.qml" + "localstorage.qml" + ) + +target_link_libraries(localstorageexample PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + +install(TARGETS localstorageexample + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/localstorage/localstorage/Database.js b/examples/quick/localstorage/Database.js index 6ad684a2bb..6ad684a2bb 100644 --- a/examples/quick/localstorage/localstorage/Database.js +++ b/examples/quick/localstorage/Database.js diff --git a/examples/quick/localstorage/localstorage/Header.qml b/examples/quick/localstorage/Header.qml index 3328a88559..3328a88559 100644 --- a/examples/quick/localstorage/localstorage/Header.qml +++ b/examples/quick/localstorage/Header.qml diff --git a/examples/quick/localstorage/localstorage/MyDelegate.qml b/examples/quick/localstorage/MyDelegate.qml index b715882ab4..b715882ab4 100644 --- a/examples/quick/localstorage/localstorage/MyDelegate.qml +++ b/examples/quick/localstorage/MyDelegate.qml diff --git a/examples/quick/localstorage/localstorage/MyModel.qml b/examples/quick/localstorage/MyModel.qml index 8665778a8c..8665778a8c 100644 --- a/examples/quick/localstorage/localstorage/MyModel.qml +++ b/examples/quick/localstorage/MyModel.qml diff --git a/examples/quick/localstorage/localstorage.pro b/examples/quick/localstorage/localstorage.pro index dd2eb80250..9709733c13 100644 --- a/examples/quick/localstorage/localstorage.pro +++ b/examples/quick/localstorage/localstorage.pro @@ -1,2 +1,9 @@ -TEMPLATE = subdirs -SUBDIRS += localstorage +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += \ + localstorage.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/localstorage +INSTALLS += target diff --git a/examples/quick/localstorage/localstorage/localstorage.qml b/examples/quick/localstorage/localstorage.qml index 15710fc55c..15710fc55c 100644 --- a/examples/quick/localstorage/localstorage/localstorage.qml +++ b/examples/quick/localstorage/localstorage.qml diff --git a/examples/quick/localstorage/localstorage/localstorage.qrc b/examples/quick/localstorage/localstorage.qrc index a761306f3d..62c72daa9f 100644 --- a/examples/quick/localstorage/localstorage/localstorage.qrc +++ b/examples/quick/localstorage/localstorage.qrc @@ -1,5 +1,5 @@ <RCC> - <qresource prefix="/"> + <qresource prefix="/localstorage"> <file>Header.qml</file> <file>Database.js</file> <file>MyModel.qml</file> diff --git a/examples/quick/localstorage/localstorage/CMakeLists.txt b/examples/quick/localstorage/localstorage/CMakeLists.txt deleted file mode 100644 index a67f80c4ea..0000000000 --- a/examples/quick/localstorage/localstorage/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# Generated from localstorage.pro. - -cmake_minimum_required(VERSION 3.16) -project(localstorage LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/localstorage/localstorage") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) -find_package(Qt6 COMPONENTS Qml) - -qt_add_executable(localstorage - main.cpp -) -set_target_properties(localstorage PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(localstorage PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - - -# Resources: -set(localstorage_resource_files - "Database.js" - "Header.qml" - "MyDelegate.qml" - "MyModel.qml" - "localstorage.qml" -) - -qt6_add_resources(localstorage "localstorage" - PREFIX - "/" - FILES - ${localstorage_resource_files} -) - -install(TARGETS localstorage - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/quick/localstorage/localstorage/localstorage.pro b/examples/quick/localstorage/localstorage/localstorage.pro deleted file mode 100644 index 8feca66f28..0000000000 --- a/examples/quick/localstorage/localstorage/localstorage.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += \ - localstorage.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/localstorage/localstorage -INSTALLS += target diff --git a/examples/quick/localstorage/localstorage/main.cpp b/examples/quick/localstorage/main.cpp index 293c81768a..6ff5d33cc5 100644 --- a/examples/quick/localstorage/localstorage/main.cpp +++ b/examples/quick/localstorage/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/localstorage.qml"))); + engine.load(QUrl(QStringLiteral("qrc:/localstorage/localstorage.qml"))); return app.exec(); } |