Fix layouts example to use a QML module
Changing the CMakeLists.txt file to use qt_add_qml_module(). Pick-to: 6.2 Change-Id: Icafe9359494136af6d5f3befaa9e767ab12deb30 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
e0990f8b40
commit
2cd4391ba0
|
@ -7,7 +7,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
|
|
||||||
if(NOT DEFINED INSTALL_EXAMPLESDIR)
|
if(NOT DEFINED INSTALL_EXAMPLESDIR)
|
||||||
set(INSTALL_EXAMPLESDIR "examples")
|
set(INSTALL_EXAMPLESDIR "examples")
|
||||||
|
@ -15,39 +14,29 @@ endif()
|
||||||
|
|
||||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/layouts")
|
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/layouts")
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS Core)
|
find_package(Qt6 COMPONENTS Core Gui Qml Quick)
|
||||||
find_package(Qt6 COMPONENTS Gui)
|
|
||||||
find_package(Qt6 COMPONENTS Qml)
|
|
||||||
find_package(Qt6 COMPONENTS Quick)
|
|
||||||
|
|
||||||
qt_add_executable(layouts
|
qt_add_executable(layoutsexample
|
||||||
|
WIN32
|
||||||
|
MACOSX_BUNDLE
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(layouts PROPERTIES
|
|
||||||
WIN32_EXECUTABLE TRUE
|
qt_add_qml_module(layoutsexample
|
||||||
MACOSX_BUNDLE TRUE
|
URI layouts
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES
|
||||||
|
"layouts.qml"
|
||||||
)
|
)
|
||||||
target_link_libraries(layouts PUBLIC
|
|
||||||
|
target_link_libraries(layoutsexample PUBLIC
|
||||||
Qt::Core
|
Qt::Core
|
||||||
Qt::Gui
|
Qt::Gui
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(TARGETS layoutsexample
|
||||||
# Resources:
|
|
||||||
set(layouts_resource_files
|
|
||||||
"layouts.qml"
|
|
||||||
)
|
|
||||||
|
|
||||||
qt6_add_resources(layouts "layouts"
|
|
||||||
PREFIX
|
|
||||||
"/layouts"
|
|
||||||
FILES
|
|
||||||
${layouts_resource_files}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS layouts
|
|
||||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
|
@ -48,9 +48,9 @@
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: appWindow
|
id: appWindow
|
||||||
|
|
Loading…
Reference in New Issue