diff options
author | Samuel Mira <samuel.mira@qt.io> | 2022-03-07 18:50:08 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-09 20:20:21 +0000 |
commit | 03a66b7205e549af5f69c9747abaa0b39483f121 (patch) | |
tree | 7abfed5ceddbe34bd1d2a6001835b82cc852a828 | |
parent | 376557f3c9bfad818ba5b68b73c1c15fd545135b (diff) |
Fix missing main.qml in examples
These examples use resources files with qml files inside but the
resource files were added in the project sources. That prevented
the app to find and use the resource files. To fix the issue the
resources were added using qt6_add_resources macro.
Note that adding the cmake flag set(CMAKE_AUTORCC ON) would also
work, but the qt6_add_resources macro is more consistent with the
rest of the examples.
Fixes: QTBUG-101518
Change-Id: I5fb2481d5576683171a2292bdc35e417ee6d8fab
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bdacf2b290e9d341ffc5d96e7bcc696ef3b7add7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | examples/multimedia/video/mediaplayer/CMakeLists.txt | 21 | ||||
-rw-r--r-- | examples/multimedia/video/mediaplayer/qml.qrc | 12 | ||||
-rw-r--r-- | examples/multimedia/video/recorder/CMakeLists.txt | 25 | ||||
-rw-r--r-- | examples/multimedia/video/recorder/qml.qrc | 18 |
4 files changed, 42 insertions, 34 deletions
diff --git a/examples/multimedia/video/mediaplayer/CMakeLists.txt b/examples/multimedia/video/mediaplayer/CMakeLists.txt index 9255ad2da..e2c356c60 100644 --- a/examples/multimedia/video/mediaplayer/CMakeLists.txt +++ b/examples/multimedia/video/mediaplayer/CMakeLists.txt @@ -30,16 +30,31 @@ find_package(Qt6 REQUIRED COMPONENTS Core Quick QuickControls2 Svg) set(PROJECT_SOURCES main.cpp - qml.qrc ) qt_add_executable(mediaplayer ${PROJECT_SOURCES} ) +set(resource_files + "main.qml" + "PlaybackControl.qml" + "MetadataInfo.qml" + "AudioControl.qml" + "PlaybackSeekControl.qml" + "PlaybackRateControl.qml" + "PlayerMenuBar.qml" + "TracksInfo.qml" + "Mute_Icon.svg" + "Speaker_Icon.svg" +) + qt6_add_resources(mediaplayer "mediaplayer" - PREFIX "/" - FILES "Mute_Icon.svg" "Speaker_Icon.svg") + PREFIX + "/" + FILES + ${resource_files} +) target_compile_definitions(mediaplayer PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) diff --git a/examples/multimedia/video/mediaplayer/qml.qrc b/examples/multimedia/video/mediaplayer/qml.qrc deleted file mode 100644 index 39caf6616..000000000 --- a/examples/multimedia/video/mediaplayer/qml.qrc +++ /dev/null @@ -1,12 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>PlaybackControl.qml</file> - <file>MetadataInfo.qml</file> - <file>AudioControl.qml</file> - <file>PlaybackSeekControl.qml</file> - <file>PlaybackRateControl.qml</file> - <file>PlayerMenuBar.qml</file> - <file>TracksInfo.qml</file> - </qresource> -</RCC> diff --git a/examples/multimedia/video/recorder/CMakeLists.txt b/examples/multimedia/video/recorder/CMakeLists.txt index ab43bbb44..63036e7b2 100644 --- a/examples/multimedia/video/recorder/CMakeLists.txt +++ b/examples/multimedia/video/recorder/CMakeLists.txt @@ -18,13 +18,36 @@ find_package(Qt6 REQUIRED COMPONENTS Core Multimedia Quick) set(PROJECT_SOURCES main.cpp - qml.qrc ) qt_add_executable(recorder ${PROJECT_SOURCES} ) +set(resource_files + "main.qml" + "qmldir" + "MediaList.qml" + "AudioInputSelect.qml" + "CameraSelect.qml" + "RecordButton.qml" + "Controls.qml" + "StyleParameter.qml" + "StyleRectangle.qml" + "SettingsMetaData.qml" + "SettingsEncoder.qml" + "StyleSlider.qml" + "Style.qml" + "Playback.qml" +) + +qt6_add_resources(recorder "recorder" + PREFIX + "/" + FILES + ${resource_files} +) + target_compile_definitions(recorder PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(recorder diff --git a/examples/multimedia/video/recorder/qml.qrc b/examples/multimedia/video/recorder/qml.qrc deleted file mode 100644 index a81fc822a..000000000 --- a/examples/multimedia/video/recorder/qml.qrc +++ /dev/null @@ -1,18 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>MediaList.qml</file> - <file>AudioInputSelect.qml</file> - <file>CameraSelect.qml</file> - <file>RecordButton.qml</file> - <file>Controls.qml</file> - <file>StyleParameter.qml</file> - <file>StyleRectangle.qml</file> - <file>SettingsMetaData.qml</file> - <file>SettingsEncoder.qml</file> - <file>StyleSlider.qml</file> - <file>Style.qml</file> - <file>qmldir</file> - <file>Playback.qml</file> - </qresource> -</RCC> |