diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-07-28 14:58:13 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-07-30 10:16:19 +0000 |
commit | 20a581cdf8c85b2f8355f2652b726951bcdd6626 (patch) | |
tree | cb1443130a780ff1f0e42eff96ed0afc155320ba | |
parent | 4ca48ee2eb3f49f0b72e60dd08aa3765568e8823 (diff) |
Native style: support building with cmake
Change-Id: Idec0507a8bbdfc345e731a9e376ef8dd00534946
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | examples/quickcontrols2/desktopgallery/CMakeLists.txt | 80 | ||||
-rw-r--r-- | src/imports/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/imports/controls/macos/CMakeLists.txt | 101 | ||||
-rw-r--r-- | src/imports/controls/windows/CMakeLists.txt | 89 | ||||
-rw-r--r-- | src/imports/nativestyle/CMakeLists.txt | 148 | ||||
-rw-r--r-- | src/imports/nativestyle/qstyle/qstyle.pri | 2 |
6 files changed, 426 insertions, 1 deletions
diff --git a/examples/quickcontrols2/desktopgallery/CMakeLists.txt b/examples/quickcontrols2/desktopgallery/CMakeLists.txt new file mode 100644 index 00000000..e4712a6e --- /dev/null +++ b/examples/quickcontrols2/desktopgallery/CMakeLists.txt @@ -0,0 +1,80 @@ +# Generated from desktopgallery.pro. + +cmake_minimum_required(VERSION 3.14) +project(desktopgallery 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}/quickcontrols2/desktopgallery") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS QuickControls2) + +add_qt_gui_executable(desktopgallery + main.cpp +) +target_link_libraries(desktopgallery PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::QuickControls2 +) + + +# Resources: +set(qmake_immediate_resource_files + "Buttons.qml" + "CheckBoxes.qml" + "ComboBoxes.qml" + "ControlContainer.qml" + "CustomButtons.qml" + "CustomCheckBoxes.qml" + "CustomComboBoxes.qml" + "CustomDials.qml" + "CustomFrames.qml" + "CustomProgressBars.qml" + "CustomRadioButtons.qml" + "CustomScrollBars.qml" + "CustomSliders.qml" + "CustomSpinBoxes.qml" + "CustomTextAreas.qml" + "CustomTextFields.qml" + "Dials.qml" + "Frames.qml" + "ProgressBars.qml" + "RadioButtons.qml" + "ScrollBars.qml" + "Sliders.qml" + "SlidersMini.qml" + "SlidersSmall.qml" + "SpinBoxes.qml" + "TextAreas.qml" + "TextFields.qml" + "checkbox-icon.png" + "checkbox-icon16.png" + "checkbox-icon@2x.png" + "main.qml" +) + +qt6_add_resources(desktopgallery "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) + +install(TARGETS desktopgallery + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt index 46b803f7..eb5ec874 100644 --- a/src/imports/CMakeLists.txt +++ b/src/imports/CMakeLists.txt @@ -3,7 +3,14 @@ add_subdirectory(controls) add_subdirectory(platform) add_subdirectory(templates) +add_subdirectory(nativestyle) add_subdirectory(controls/fusion) add_subdirectory(controls/imagine) add_subdirectory(controls/material) add_subdirectory(controls/universal) +if(MACOS) + add_subdirectory(controls/macos) +endif() +if(WIN32) + add_subdirectory(controls/windows) +endif() diff --git a/src/imports/controls/macos/CMakeLists.txt b/src/imports/controls/macos/CMakeLists.txt new file mode 100644 index 00000000..76f87189 --- /dev/null +++ b/src/imports/controls/macos/CMakeLists.txt @@ -0,0 +1,101 @@ +# Generated from macos.pro. + +##################################################################### +## qtquickcontrols2macosstyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2macosstyleplugin + TARGET_PATH "QtQuick/Controls.2/macOS" + URI "QtQuick.Controls.macOS" + VERSION "2.0" + CLASSNAME QtQuickControls2MacOSStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + GENERATE_QMLTYPES + SOURCES + qtquickcontrols2macosstyleplugin.cpp + DEFINES + QT_NO_CAST_FROM_ASCII + QT_NO_CAST_TO_ASCII + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::QmlPrivate + Qt::QuickControls2Private + Qt::QuickPrivate + Qt::QuickTemplates2Private + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::QuickControls2 + Qt::QuickTemplates2 +) + +#### Keys ignored in scope 1:.:.:macos.pro:<TRUE>: +# OTHER_FILES = "qmldir" "$$QML_FILES" +# QML_IMPORT_MAJOR_VERSION = "2" +# QML_IMPORT_NAME = "QtQuick.Controls.macOS" +# TARGETPATH = "QtQuick/Controls.2/macOS" + +set(qml_files + "Button.qml" + "Slider.qml" + "GroupBox.qml" + "CheckBox.qml" + "RadioButton.qml" + "SpinBox.qml" + "TextField.qml" + "Frame.qml" + "TextArea.qml" + "ComboBox.qml" + "ScrollBar.qml" + "ProgressBar.qml" + "Dial.qml" +) +set_source_files_properties(Button.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Slider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(GroupBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(CheckBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SpinBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TextField.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Frame.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TextArea.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ComboBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ScrollBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ProgressBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2macosstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/windows/CMakeLists.txt b/src/imports/controls/windows/CMakeLists.txt new file mode 100644 index 00000000..bede8e30 --- /dev/null +++ b/src/imports/controls/windows/CMakeLists.txt @@ -0,0 +1,89 @@ +# Generated from windows.pro. + +##################################################################### +## qtquickcontrols2windowsstyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2windowsstyleplugin + TARGET_PATH "QtQuick/Controls.2/Windows" + URI "QtQuick.Controls.Windows" + VERSION "6.0" + CLASSNAME QtQuickControls2WindowsStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + GENERATE_QMLTYPES + SOURCES + qtquickcontrols2windowsstyleplugin.cpp + DEFINES + QT_NO_CAST_FROM_ASCII + QT_NO_CAST_TO_ASCII + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::QmlPrivate + Qt::QuickControls2Private + Qt::QuickPrivate + Qt::QuickTemplates2Private + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::QuickControls2 + Qt::QuickTemplates2 +) + +#### Keys ignored in scope 1:.:.:windows.pro:<TRUE>: +# OTHER_FILES = "qmldir" "$$QML_FILES" +# QML_IMPORT_MAJOR_VERSION = "6" +# QML_IMPORT_NAME = "QtQuick.Controls.Windows" +# TARGETPATH = "QtQuick/Controls.2/Windows" + +set(qml_files + "Button.qml" + "CheckBox.qml" + "ComboBox.qml" + "Frame.qml" + "GroupBox.qml" + "RadioButton.qml" + "Slider.qml" + "SpinBox.qml" + "TextArea.qml" + "TextField.qml" +) +set_source_files_properties(Button.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(CheckBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ComboBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Frame.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(GroupBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Slider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SpinBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TextArea.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TextField.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2windowsstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/nativestyle/CMakeLists.txt b/src/imports/nativestyle/CMakeLists.txt new file mode 100644 index 00000000..08c44e7f --- /dev/null +++ b/src/imports/nativestyle/CMakeLists.txt @@ -0,0 +1,148 @@ +# Generated from nativestyle.pro. + +##################################################################### +## qtquickcontrols2nativestyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2nativestyleplugin + URI "QtQuick.NativeStyle" + VERSION "6.0" + CLASSNAME QtQuickControls2NativeStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + GENERATE_QMLTYPES + SOURCES + items/qquickstyleitem.cpp items/qquickstyleitem.h + items/qquickstyleitembutton.cpp items/qquickstyleitembutton.h + items/qquickstyleitemcheckbox.cpp items/qquickstyleitemcheckbox.h + items/qquickstyleitemcombobox.cpp items/qquickstyleitemcombobox.h + items/qquickstyleitemdial.cpp items/qquickstyleitemdial.h + items/qquickstyleitemframe.cpp items/qquickstyleitemframe.h + items/qquickstyleitemgroupbox.cpp items/qquickstyleitemgroupbox.h + items/qquickstyleitemprogressbar.cpp items/qquickstyleitemprogressbar.h + items/qquickstyleitemradiobutton.cpp items/qquickstyleitemradiobutton.h + items/qquickstyleitemscrollbar.cpp items/qquickstyleitemscrollbar.h + items/qquickstyleitemslider.cpp items/qquickstyleitemslider.h + items/qquickstyleitemspinbox.cpp items/qquickstyleitemspinbox.h + items/qquickstyleitemtextarea.cpp items/qquickstyleitemtextarea.h + items/qquickstyleitemtextfield.cpp items/qquickstyleitemtextfield.h + qstyle/qquickcommonstyle.cpp qstyle/qquickcommonstyle.h qstyle/qquickcommonstyle_p.h + qstyle/qquickcommonstylepixmaps_p.h + qstyle/qquickdrawutil.cpp qstyle/qquickdrawutil.h + qstyle/qquicknativestyle.cpp qstyle/qquicknativestyle.h + qstyle/qquickstyle.cpp qstyle/qquickstyle.h qstyle/qquickstyle_p.h + qstyle/qquickstylehelper.cpp qstyle/qquickstylehelper_p.h + qstyle/qquickstyleoption.cpp qstyle/qquickstyleoption.h + qtquickcontrols2nativestyleplugin.cpp + DEFINES + QT_NO_CAST_FROM_ASCII + QT_NO_CAST_TO_ASCII + INCLUDE_DIRECTORIES + items + qstyle + LIBRARIES + Qt::CorePrivate + Qt::GuiPrivate + Qt::QmlPrivate + Qt::QuickControls2Private + Qt::QuickPrivate + Qt::QuickTemplates2Private + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::QuickControls2 + Qt::QuickTemplates2 +) + +#### Keys ignored in scope 1:.:.:nativestyle.pro:<TRUE>: +# OTHER_FILES = "qmldir" "$$QML_FILES" +# QML_IMPORT_MAJOR_VERSION = "6" +# QML_IMPORT_NAME = "QtQuick.NativeStyle" +# TARGETPATH = "QtQuick/NativeStyle" + +## Scopes: +##################################################################### + +qt_extend_target(qtquickcontrols2nativestyleplugin CONDITION MACOS + SOURCES + qstyle/mac/qquickmacstyle_mac.mm qstyle/mac/qquickmacstyle_mac_p.h + qstyle/mac/qquickmacstyle_mac_p_p.h + INCLUDE_DIRECTORIES + qstyle/mac + LIBRARIES + ${FWAppKit} +) + +qt_extend_target(qtquickcontrols2nativestyleplugin CONDITION WIN32 + SOURCES + qstyle/windows/qquickwindowsstyle.cpp qstyle/windows/qquickwindowsstyle_p.h + qstyle/windows/qquickwindowsstyle_p_p.h + INCLUDE_DIRECTORIES + qstyle/windows + LIBRARIES + gdi32 + user32 + uxtheme +) + +set(qml_files + "controls/DefaultButton.qml" + "controls/DefaultSlider.qml" + "controls/DefaultGroupBox.qml" + "controls/DefaultCheckBox.qml" + "controls/DefaultRadioButton.qml" + "controls/DefaultSpinBox.qml" + "controls/DefaultTextField.qml" + "controls/DefaultFrame.qml" + "controls/DefaultTextArea.qml" + "controls/DefaultComboBox.qml" + "controls/DefaultScrollBar.qml" + "controls/DefaultProgressBar.qml" + "controls/DefaultDial.qml" +) +set_source_files_properties(controls/DefaultButton.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultSlider.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultGroupBox.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultCheckBox.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultRadioButton.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultSpinBox.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultTextField.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultFrame.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultTextArea.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultComboBox.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultScrollBar.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultProgressBar.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) +set_source_files_properties(controls/DefaultDial.qml PROPERTIES + QT_QML_SOURCE_VERSION "6.0" +) + +qt6_target_qml_files(qtquickcontrols2nativestyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/nativestyle/qstyle/qstyle.pri b/src/imports/nativestyle/qstyle/qstyle.pri index 33257845..4d025498 100644 --- a/src/imports/nativestyle/qstyle/qstyle.pri +++ b/src/imports/nativestyle/qstyle/qstyle.pri @@ -20,4 +20,4 @@ SOURCES += \ $$PWD/qquickstyleoption.cpp macos: include(mac/mac.pri) -windows: include(windows/windows.pri) +win32: include(windows/windows.pri) |