Fix dialcontrol example to use a QML module

Also move the QML files out of the "content" subdirectory in order to
avoid the directory import.

Pick-to: 6.2
Change-Id: I84a1f5ef1a45e5098ec3213c6fbce06346f3606a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Ulf Hermann 2021-08-31 13:32:26 +02:00
parent 66c011c558
commit 2dfb912058
11 changed files with 26 additions and 32 deletions

View File

@ -20,41 +20,36 @@ find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Quick)
find_package(Qt6 COMPONENTS Qml)
qt_add_executable(dialcontrol
qt_add_executable(dialcontrolexample
main.cpp
)
set_target_properties(dialcontrol PROPERTIES
set_target_properties(dialcontrolexample PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(dialcontrol PUBLIC
target_link_libraries(dialcontrolexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
# Resources:
set(dialcontrol_resource_files
"content/Dial.qml"
"content/QuitButton.qml"
"content/background.png"
"content/needle.png"
"content/needle_shadow.png"
"content/overlay.png"
"content/quit.png"
"dialcontrol.qml"
qt_add_qml_module(dialcontrolexample
URI dialcontrol
VERSION 1.0
QML_FILES
"Dial.qml"
"QuitButton.qml"
"dialcontrol.qml"
RESOURCES
"background.png"
"needle.png"
"needle_shadow.png"
"overlay.png"
"quit.png"
)
qt6_add_resources(dialcontrol "dialcontrol"
PREFIX
"/"
FILES
${dialcontrol_resource_files}
)
install(TARGETS dialcontrol
install(TARGETS dialcontrolexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -51,7 +51,6 @@
//! [imports]
import QtQuick 2.2
import QtQuick.Window 2.1
import "content"
//! [imports]
//! [0]

View File

@ -1,12 +1,12 @@
<RCC>
<qresource prefix="/">
<qresource prefix="/dialcontrol">
<file>Dial.qml</file>
<file>QuitButton.qml</file>
<file>background.png</file>
<file>dialcontrol.qml</file>
<file>content/background.png</file>
<file>content/Dial.qml</file>
<file>content/needle_shadow.png</file>
<file>content/needle.png</file>
<file>content/overlay.png</file>
<file>content/quit.png</file>
<file>content/QuitButton.qml</file>
<file>needle.png</file>
<file>needle_shadow.png</file>
<file>overlay.png</file>
<file>quit.png</file>
</qresource>
</RCC>

View File

@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
DECLARATIVE_EXAMPLE_MAIN(dialcontrol)
DECLARATIVE_EXAMPLE_MAIN(dialcontrol/dialcontrol)

View File

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B