diff options
Diffstat (limited to 'src/imports/controls')
51 files changed, 2546 insertions, 241 deletions
diff --git a/src/imports/controls/.prev_CMakeLists.txt b/src/imports/controls/.prev_CMakeLists.txt new file mode 100644 index 00000000..e017f0fe --- /dev/null +++ b/src/imports/controls/.prev_CMakeLists.txt @@ -0,0 +1,146 @@ +# Generated from controls.pro. + +##################################################################### +## qtquickcontrols2plugin Plugin: +##################################################################### + +add_qml_module(qtquickcontrols2plugin + TARGET_PATH "QtQuick/Controls.2" + URI "QtQuick.Controls" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + DESIGNER_SUPPORTED + CLASSNAME QtQuickControls2Plugin + DEPENDENCIES + QtQuick.Templates/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickdefaultbusyindicator.cpp qquickdefaultbusyindicator_p.h + qquickdefaultdial.cpp qquickdefaultdial_p.h + qquickdefaultprogressbar.cpp qquickdefaultprogressbar_p.h + qquickdefaultstyle.cpp qquickdefaultstyle_p.h + qquickdefaulttheme.cpp qquickdefaulttheme_p.h + qtquickcontrols2plugin.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 +) + +# Resources: +set(qtquickcontrols2plugin_resource_files + "images/arrow-indicator.png" + "images/arrow-indicator@2x.png" + "images/arrow-indicator@3x.png" + "images/arrow-indicator@4x.png" + "images/check.png" + "images/check@2x.png" + "images/check@3x.png" + "images/check@4x.png" + "images/dial-indicator.png" + "images/dial-indicator@2x.png" + "images/dial-indicator@3x.png" + "images/dial-indicator@4x.png" + "images/double-arrow.png" + "images/double-arrow@2x.png" + "images/double-arrow@3x.png" + "images/double-arrow@4x.png" + "images/drop-indicator.png" + "images/drop-indicator@2x.png" + "images/drop-indicator@3x.png" + "images/drop-indicator@4x.png" +) + +add_qt_resource(qtquickcontrols2plugin "qtquickcontrols2plugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2" + FILES + ${qtquickcontrols2plugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:controls.pro:<TRUE>: +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" "$$PWD/snippets/*.qml" "$$PWD/src/*.qdoc" "$$PWD/src/calendar/*.qdoc" "$$PWD/src/templates/*.qdoc" +# TARGETPATH = "QtQuick/Controls.2" +# _REQUIREMENTS = "qtConfig(quickcontrols2-default)" + +## Scopes: +##################################################################### + +set(qml_files + "AbstractButton.qml" + "Action.qml" + "ActionGroup.qml" + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "ButtonGroup.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "ComboBox.qml" + "Container.qml" + "Control.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "ScrollView.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "Switch.qml" + "SwitchDelegate.qml" + "SwipeView.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" +) + +qt6_target_qml_files(qtquickcontrols2plugin + FILES + ${qml_files} +) +add_qt_docs(qtquickcontrols2plugin + doc/qtquickcontrols.qdocconf +) + diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml index 4686a298..85dfd279 100644 --- a/src/imports/controls/ApplicationWindow.qml +++ b/src/imports/controls/ApplicationWindow.qml @@ -43,7 +43,7 @@ import QtQuick.Templates 2.12 as T T.ApplicationWindow { id: window - color: palette.window + color: window.palette.window overlay.modal: Rectangle { color: Color.transparent(window.palette.shadow, 0.5) diff --git a/src/imports/controls/CMakeLists.txt b/src/imports/controls/CMakeLists.txt new file mode 100644 index 00000000..626155f8 --- /dev/null +++ b/src/imports/controls/CMakeLists.txt @@ -0,0 +1,319 @@ +# Generated from controls.pro. + +##################################################################### +## qtquickcontrols2plugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2plugin + TARGET_PATH "QtQuick/Controls.2" + URI "QtQuick.Controls" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + DESIGNER_SUPPORTED + CLASSNAME QtQuickControls2Plugin + DEPENDENCIES + QtQuick.Templates/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickdefaultbusyindicator.cpp qquickdefaultbusyindicator_p.h + qquickdefaultdial.cpp qquickdefaultdial_p.h + qquickdefaultprogressbar.cpp qquickdefaultprogressbar_p.h + qquickdefaultstyle.cpp qquickdefaultstyle_p.h + qquickdefaulttheme.cpp qquickdefaulttheme_p.h + qtquickcontrols2plugin.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 +) + +# Resources: +set(qtquickcontrols2plugin_resource_files + "images/arrow-indicator.png" + "images/arrow-indicator@2x.png" + "images/arrow-indicator@3x.png" + "images/arrow-indicator@4x.png" + "images/check.png" + "images/check@2x.png" + "images/check@3x.png" + "images/check@4x.png" + "images/dial-indicator.png" + "images/dial-indicator@2x.png" + "images/dial-indicator@3x.png" + "images/dial-indicator@4x.png" + "images/double-arrow.png" + "images/double-arrow@2x.png" + "images/double-arrow@3x.png" + "images/double-arrow@4x.png" + "images/drop-indicator.png" + "images/drop-indicator@2x.png" + "images/drop-indicator@3x.png" + "images/drop-indicator@4x.png" +) + +qt_add_resource(qtquickcontrols2plugin "qtquickcontrols2plugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2" + FILES + ${qtquickcontrols2plugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:controls.pro:<TRUE>: +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" "$$PWD/snippets/*.qml" "$$PWD/src/*.qdoc" "$$PWD/src/calendar/*.qdoc" "$$PWD/src/templates/*.qdoc" +# TARGETPATH = "QtQuick/Controls.2" +# _REQUIREMENTS = "qtConfig(quickcontrols2-default)" + +## Scopes: +##################################################################### + +set(qml_files + "AbstractButton.qml" + "Action.qml" + "ActionGroup.qml" + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "ButtonGroup.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "ComboBox.qml" + "Container.qml" + "Control.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "ScrollView.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "Switch.qml" + "SwitchDelegate.qml" + "SwipeView.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(AbstractButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Action.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ActionGroup.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Button.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ButtonGroup.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(CheckDelegate.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(Container.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Control.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBarItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.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(ScrollIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ScrollView.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(StackView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.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 +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2plugin + FILES + ${qml_files} +) +qt_add_docs(qtquickcontrols2plugin + doc/qtquickcontrols.qdocconf +) + diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index b30293f5..e9f93d66 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -53,7 +53,7 @@ T.ComboBox { rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData palette.text: control.palette.text palette.highlightedText: control.palette.highlightedText diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index cc4618a5..e7c732cd 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -43,9 +43,9 @@ T.Dial { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 184 // ### remove 184 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 184 // ### remove 184 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) background: DialImpl { implicitWidth: 184 @@ -56,8 +56,8 @@ T.Dial { } handle: ColorImage { - x: control.background.x + control.background.width / 2 - control.handle.width / 2 - y: control.background.y + control.background.height / 2 - control.handle.height / 2 + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 width: 14 height: 10 defaultColor: "#353637" diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml index cd10263b..4d1abdd3 100644 --- a/src/imports/controls/Tumbler.qml +++ b/src/imports/controls/Tumbler.qml @@ -43,9 +43,9 @@ T.Tumbler { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) delegate: Text { text: modelData diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml index daa54967..dd58b5ab 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml @@ -25,7 +25,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 import QtQuick.Controls 2.12 //! [1] @@ -36,8 +36,8 @@ SpinBox { property var items: ["Small", "Medium", "Large"] - validator: RegExpValidator { - regExp: new RegExp("(Small|Medium|Large)", "i") + validator: RegularExpressionValidator { + regularExpression: new RegExp("(Small|Medium|Large)", "i") } textFromValue: function(value) { diff --git a/src/imports/controls/doc/src/qtquickcontrols2-palette.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-palette.qdoc deleted file mode 100644 index e4bac54a..00000000 --- a/src/imports/controls/doc/src/qtquickcontrols2-palette.qdoc +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \qmlbasictype palette - \brief a palette of colors. - \target qtquickcontrols2-palette - - The \c palette type refers to a palette of colors for various roles. - - Available properties: - \table - \header - \li Property - \li Description - \row - \li \b palette.alternateBase : color - \li Used as the alternate background color in item views with alternating row colors. - \row - \li \b palette.base : color - \li Used mostly as the background color for text editor controls and items views. - It is usually white or another light color. - \row - \li \b palette.brightText : color - \li A text color that is very different from \c palette.windowText, and contrasts - well with e.g. \c palette.dark. Typically used for text that needs to be drawn - where \c palette.text, \c palette.windowText or \c palette.buttonText would - give poor contrast, such as on highlighted buttons. - \row - \li \b palette.button : color - \li The general button background color. This background can be different from - \c palette.window as some styles require a different background color for buttons. - \row - \li \b palette.buttonText : color - \li A foreground color used with the \c palette.button color. - \row - \li \b palette.dark : color - \li Darker than \c palette.button. - \row - \li \b palette.highlight : color - \li A color to indicate a selected item or the current item. - \row - \li \b palette.highlightedText : color - \li A text color that contrasts with \c palette.highlight. - \row - \li \b palette.light : color - \li Lighter than \c palette.button. - \row - \li \b palette.link : color - \li A text color used for hyperlinks. - \row - \li \b palette.linkVisited : color - \li A text color used for already visited hyperlinks. - \row - \li \b palette.mid : color - \li Between \c palette.button and \c palette.dark. - \row - \li \b palette.midlight : color - \li Between \c palette.button and \c palette.light. - \row - \li \b palette.shadow : color - \li A very dark color. - \row - \li \b palette.text : color - \li The foreground color used with \c palette.base. This is usually the same as - the \c palette.windowText, in which case it must provide good contrast with - \c palette.window and \c palette.base. - \row - \li \b palette.toolTipBase : color - \li Used as the background color for tooltips. - \row - \li \b palette.toolTipText : color - \li Used as the foreground color for tooltips. - \row - \li \b palette.window : color - \li A general background color. - \row - \li \b palette.windowText : color - \li A general foreground color. - \endtable - - \sa Control::palette, Popup::palette, ApplicationWindow::palette, QPalette::ColorRole -*/ diff --git a/src/imports/controls/fusion/.prev_CMakeLists.txt b/src/imports/controls/fusion/.prev_CMakeLists.txt new file mode 100644 index 00000000..2fb5b2a1 --- /dev/null +++ b/src/imports/controls/fusion/.prev_CMakeLists.txt @@ -0,0 +1,128 @@ +# Generated from fusion.pro. + +##################################################################### +## qtquickcontrols2fusionstyleplugin Plugin: +##################################################################### + +add_qml_module(qtquickcontrols2fusionstyleplugin + TARGET_PATH "QtQuick/Controls.2/Fusion" + URI "QtQuick.Controls.Fusion" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2FusionStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickfusionbusyindicator.cpp qquickfusionbusyindicator_p.h + qquickfusiondial.cpp qquickfusiondial_p.h + qquickfusionknob.cpp qquickfusionknob_p.h + qquickfusionstyle.cpp qquickfusionstyle_p.h + qquickfusiontheme.cpp qquickfusiontheme_p.h + qtquickcontrols2fusionstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2fusionstyle_resource_files + "images/arrow.png" + "images/arrow@2x.png" + "images/arrow@3x.png" + "images/arrow@4x.png" + "images/checkmark.png" + "images/checkmark@2x.png" + "images/checkmark@3x.png" + "images/checkmark@4x.png" + "images/progressmask.png" + "images/progressmask@2x.png" + "images/progressmask@3x.png" + "images/progressmask@4x.png" +) + +add_qt_resource(qtquickcontrols2fusionstyleplugin "qtquickcontrols2fusionstyle" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Fusion" + FILES + ${qtquickcontrols2fusionstyle_resource_files} +) + + +#### Keys ignored in scope 1:.:.:fusion.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Fusion" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Fusion" +# _REQUIREMENTS = "qtConfig(quickcontrols2-fusion)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "ButtonPanel.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SliderGroove.qml" + "SliderHandle.qml" + "SpinBox.qml" + "SplitView.qml" + "SwipeDelegate.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "Switch.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" +) + +qt6_target_qml_files(qtquickcontrols2fusionstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/fusion/ApplicationWindow.qml b/src/imports/controls/fusion/ApplicationWindow.qml index 9079403e..30c921cb 100644 --- a/src/imports/controls/fusion/ApplicationWindow.qml +++ b/src/imports/controls/fusion/ApplicationWindow.qml @@ -43,7 +43,7 @@ import QtQuick.Controls.Fusion.impl 2.12 T.ApplicationWindow { id: window - color: palette.window + color: window.palette.window overlay.modal: Rectangle { color: Fusion.topShadow diff --git a/src/imports/controls/fusion/CMakeLists.txt b/src/imports/controls/fusion/CMakeLists.txt new file mode 100644 index 00000000..59b06842 --- /dev/null +++ b/src/imports/controls/fusion/CMakeLists.txt @@ -0,0 +1,292 @@ +# Generated from fusion.pro. + +##################################################################### +## qtquickcontrols2fusionstyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2fusionstyleplugin + TARGET_PATH "QtQuick/Controls.2/Fusion" + URI "QtQuick.Controls.Fusion" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2FusionStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickfusionbusyindicator.cpp qquickfusionbusyindicator_p.h + qquickfusiondial.cpp qquickfusiondial_p.h + qquickfusionknob.cpp qquickfusionknob_p.h + qquickfusionstyle.cpp qquickfusionstyle_p.h + qquickfusiontheme.cpp qquickfusiontheme_p.h + qtquickcontrols2fusionstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2fusionstyle_resource_files + "images/arrow.png" + "images/arrow@2x.png" + "images/arrow@3x.png" + "images/arrow@4x.png" + "images/checkmark.png" + "images/checkmark@2x.png" + "images/checkmark@3x.png" + "images/checkmark@4x.png" + "images/progressmask.png" + "images/progressmask@2x.png" + "images/progressmask@3x.png" + "images/progressmask@4x.png" +) + +qt_add_resource(qtquickcontrols2fusionstyleplugin "qtquickcontrols2fusionstyle" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Fusion" + FILES + ${qtquickcontrols2fusionstyle_resource_files} +) + + +#### Keys ignored in scope 1:.:.:fusion.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Fusion" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Fusion" +# _REQUIREMENTS = "qtConfig(quickcontrols2-fusion)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "ButtonPanel.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SliderGroove.qml" + "SliderHandle.qml" + "SpinBox.qml" + "SplitView.qml" + "SwipeDelegate.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "Switch.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Button.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ButtonPanel.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(CheckDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(CheckIndicator.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(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBarItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.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(ScrollIndicator.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(SliderGroove.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SliderHandle.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.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 +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2fusionstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml index d8ef1888..d0e4b564 100644 --- a/src/imports/controls/fusion/ComboBox.qml +++ b/src/imports/controls/fusion/ComboBox.qml @@ -55,7 +55,7 @@ T.ComboBox { rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing) delegate: MenuItem { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index @@ -145,7 +145,6 @@ T.ComboBox { height: Math.min(contentItem.implicitHeight + 2, control.Window.height - topMargin - bottomMargin) topMargin: 6 bottomMargin: 6 - palette: control.palette padding: 1 contentItem: ListView { diff --git a/src/imports/controls/fusion/Dial.qml b/src/imports/controls/fusion/Dial.qml index a1337242..3c22c66a 100644 --- a/src/imports/controls/fusion/Dial.qml +++ b/src/imports/controls/fusion/Dial.qml @@ -45,23 +45,21 @@ T.Dial { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) background: DialImpl { implicitWidth: 100 implicitHeight: 100 - palette: control.palette highlight: control.visualFocus } handle: KnobImpl { - x: control.background.x + control.background.width / 2 - control.handle.width / 2 - y: control.background.y + control.background.height / 2 - control.handle.height / 2 + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 width: control.width / 7 height: control.height / 7 - palette: control.palette transform: [ Translate { y: -Math.min(control.background.width, control.background.height) * 0.42 + control.handle.height diff --git a/src/imports/controls/fusion/Tumbler.qml b/src/imports/controls/fusion/Tumbler.qml index 0129f06c..c26bd145 100644 --- a/src/imports/controls/fusion/Tumbler.qml +++ b/src/imports/controls/fusion/Tumbler.qml @@ -45,9 +45,9 @@ T.Tumbler { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) delegate: Text { text: modelData diff --git a/src/imports/controls/fusion/qquickfusiondial.cpp b/src/imports/controls/fusion/qquickfusiondial.cpp index 50436634..eb6f21ad 100644 --- a/src/imports/controls/fusion/qquickfusiondial.cpp +++ b/src/imports/controls/fusion/qquickfusiondial.cpp @@ -38,6 +38,8 @@ #include <QtGui/qpainter.h> #include <QtGui/private/qmath_p.h> +#include <QtQuick/private/qquickpalette_p.h> +#include <QtQuick/private/qquickitem_p.h> QT_BEGIN_NAMESPACE @@ -60,20 +62,6 @@ void QQuickFusionDial::setHighlight(bool highlight) update(); } -QPalette QQuickFusionDial::palette() const -{ - return m_palette; -} - -void QQuickFusionDial::setPalette(const QPalette &palette) -{ - if (palette == m_palette) - return; - - m_palette = palette; - update(); -} - // based on QStyleHelper::drawDial() void QQuickFusionDial::paint(QPainter *painter) { @@ -82,7 +70,7 @@ void QQuickFusionDial::paint(QPainter *painter) if (width <= 0 || height <= 0 || !isVisible()) return; - QColor buttonColor = m_palette.button().color(); + QColor buttonColor = QQuickItemPrivate::get(this)->palette()->button(); const bool enabled = isEnabled(); qreal r = qMin(width, height) / 2.0; r -= r/50; @@ -137,7 +125,7 @@ void QQuickFusionDial::paint(QPainter *painter) painter->drawEllipse(br.adjusted(1, 1, -1, -1)); if (m_highlight) { - QColor highlight = m_palette.highlight().color(); + QColor highlight = QQuickItemPrivate::get(this)->palette()->highlight(); highlight.setHsv(highlight.hue(), qMin(160, highlight.saturation()), qMax(230, highlight.value())); diff --git a/src/imports/controls/fusion/qquickfusiondial_p.h b/src/imports/controls/fusion/qquickfusiondial_p.h index 740545d8..07c80cdb 100644 --- a/src/imports/controls/fusion/qquickfusiondial_p.h +++ b/src/imports/controls/fusion/qquickfusiondial_p.h @@ -48,7 +48,6 @@ // We mean it. // -#include <QtGui/qpalette.h> #include <QtQuick/qquickpainteditem.h> QT_BEGIN_NAMESPACE @@ -57,7 +56,6 @@ class QQuickFusionDial : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(bool highlight READ highlight WRITE setHighlight FINAL) - Q_PROPERTY(QPalette palette READ palette WRITE setPalette FINAL) public: explicit QQuickFusionDial(QQuickItem *parent = nullptr); @@ -65,14 +63,10 @@ public: bool highlight() const; void setHighlight(bool highlight); - QPalette palette() const; - void setPalette(const QPalette &palette); - void paint(QPainter *painter) override; private: bool m_highlight = false; - QPalette m_palette; }; QT_END_NAMESPACE diff --git a/src/imports/controls/fusion/qquickfusionknob.cpp b/src/imports/controls/fusion/qquickfusionknob.cpp index 9f1824a6..a641d190 100644 --- a/src/imports/controls/fusion/qquickfusionknob.cpp +++ b/src/imports/controls/fusion/qquickfusionknob.cpp @@ -38,26 +38,15 @@ #include <QtCore/qmath.h> #include <QtGui/qpainter.h> +#include <QtQuick/private/qquickpalette_p.h> +#include <QtQuick/private/qquickitem_p.h> QT_BEGIN_NAMESPACE QQuickFusionKnob::QQuickFusionKnob(QQuickItem *parent) : QQuickPaintedItem(parent) { -} - -QPalette QQuickFusionKnob::palette() const -{ - return m_palette; -} - -void QQuickFusionKnob::setPalette(const QPalette &palette) -{ - if (palette == m_palette) - return; - - m_palette = palette; - update(); + connect(this, &QQuickItem::paletteChanged, this, [this](){ update(); }); } // extracted from QStyleHelper::drawDial() @@ -68,7 +57,7 @@ void QQuickFusionKnob::paint(QPainter *painter) if (w <= 0 || h <= 0) return; - QColor color = m_palette.color(QPalette::Button); + QColor color = QQuickItemPrivate::get(this)->palette()->button(); color.setHsv(color.hue(), qMin(140, color .saturation()), qMax(180, color.value())); diff --git a/src/imports/controls/fusion/qquickfusionknob_p.h b/src/imports/controls/fusion/qquickfusionknob_p.h index 062aaf21..85e5f53e 100644 --- a/src/imports/controls/fusion/qquickfusionknob_p.h +++ b/src/imports/controls/fusion/qquickfusionknob_p.h @@ -48,7 +48,6 @@ // We mean it. // -#include <QtGui/qpalette.h> #include <QtQuick/qquickpainteditem.h> QT_BEGIN_NAMESPACE @@ -56,18 +55,11 @@ QT_BEGIN_NAMESPACE class QQuickFusionKnob : public QQuickPaintedItem { Q_OBJECT - Q_PROPERTY(QPalette palette READ palette WRITE setPalette FINAL) public: explicit QQuickFusionKnob(QQuickItem *parent = nullptr); - QPalette palette() const; - void setPalette(const QPalette &palette); - void paint(QPainter *painter) override; - -private: - QPalette m_palette; }; QT_END_NAMESPACE diff --git a/src/imports/controls/fusion/qquickfusionstyle.cpp b/src/imports/controls/fusion/qquickfusionstyle.cpp index 364f8a75..95064aa4 100644 --- a/src/imports/controls/fusion/qquickfusionstyle.cpp +++ b/src/imports/controls/fusion/qquickfusionstyle.cpp @@ -41,6 +41,8 @@ #include <QtGui/qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> +#include <QtQuick/private/qquickpalette_p.h> + QT_BEGIN_NAMESPACE QQuickFusionStyle::QQuickFusionStyle(QObject *parent) @@ -68,22 +70,22 @@ QColor QQuickFusionStyle::innerContrastLine() return QColor(255, 255, 255, 30); } -QColor QQuickFusionStyle::highlight(const QPalette &palette) +QColor QQuickFusionStyle::highlight(QQuickPalette *palette) { - return palette.color(QPalette::Highlight); + return palette->highlight(); } -QColor QQuickFusionStyle::highlightedText(const QPalette &palette) +QColor QQuickFusionStyle::highlightedText(QQuickPalette *palette) { - return palette.color(QPalette::HighlightedText); + return palette->highlightedText(); } -QColor QQuickFusionStyle::outline(const QPalette &palette) +QColor QQuickFusionStyle::outline(QQuickPalette *palette) { - return palette.window().color().darker(140); + return palette->window().darker(140); } -QColor QQuickFusionStyle::highlightedOutline(const QPalette &palette) +QColor QQuickFusionStyle::highlightedOutline(QQuickPalette *palette) { QColor highlightedOutline = highlight(palette).darker(125); if (highlightedOutline.value() > 160) @@ -91,17 +93,17 @@ QColor QQuickFusionStyle::highlightedOutline(const QPalette &palette) return highlightedOutline; } -QColor QQuickFusionStyle::tabFrameColor(const QPalette &palette) +QColor QQuickFusionStyle::tabFrameColor(QQuickPalette *palette) { return buttonColor(palette).lighter(104); } -QColor QQuickFusionStyle::buttonColor(const QPalette &palette, bool highlighted, bool down, bool hovered) +QColor QQuickFusionStyle::buttonColor(QQuickPalette *palette, bool highlighted, bool down, bool hovered) { - QColor buttonColor = palette.button().color(); + QColor buttonColor = palette->button(); int val = qGray(buttonColor.rgb()); buttonColor = buttonColor.lighter(100 + qMax(1, (180 - val)/6)); - buttonColor.setHsv(buttonColor.hue(), buttonColor.saturation() * 0.75, buttonColor.value()); + buttonColor.setHsv(buttonColor.hue(), int(buttonColor.saturation() * 0.75), buttonColor.value()); if (highlighted) buttonColor = mergedColors(buttonColor, highlightedOutline(palette).lighter(130), 90); if (!hovered) @@ -111,7 +113,7 @@ QColor QQuickFusionStyle::buttonColor(const QPalette &palette, bool highlighted, return buttonColor; } -QColor QQuickFusionStyle::buttonOutline(const QPalette &palette, bool highlighted, bool enabled) +QColor QQuickFusionStyle::buttonOutline(QQuickPalette *palette, bool highlighted, bool enabled) { QColor darkOutline = enabled && highlighted ? highlightedOutline(palette) : outline(palette); return !enabled ? darkOutline.lighter(115) : darkOutline; @@ -137,7 +139,7 @@ QColor QQuickFusionStyle::mergedColors(const QColor &colorA, const QColor &color return tmp; } -QColor QQuickFusionStyle::grooveColor(const QPalette &palette) +QColor QQuickFusionStyle::grooveColor(QQuickPalette *palette) { QColor color = buttonColor(palette); color.setHsv(color.hue(), diff --git a/src/imports/controls/fusion/qquickfusionstyle_p.h b/src/imports/controls/fusion/qquickfusionstyle_p.h index e0a99cc6..0e7526ee 100644 --- a/src/imports/controls/fusion/qquickfusionstyle_p.h +++ b/src/imports/controls/fusion/qquickfusionstyle_p.h @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE +class QQuickPalette; + class QQuickFusionStyle : public QObject { Q_OBJECT @@ -69,17 +71,17 @@ public: static QColor topShadow(); static QColor innerContrastLine(); - Q_INVOKABLE static QColor highlight(const QPalette &palette); - Q_INVOKABLE static QColor highlightedText(const QPalette &palette); - Q_INVOKABLE static QColor outline(const QPalette &palette); - Q_INVOKABLE static QColor highlightedOutline(const QPalette &palette); - Q_INVOKABLE static QColor tabFrameColor(const QPalette &palette); - Q_INVOKABLE static QColor buttonColor(const QPalette &palette, bool highlighted = false, bool down = false, bool hovered = false); - Q_INVOKABLE static QColor buttonOutline(const QPalette &palette, bool highlighted = false, bool enabled = true); + Q_INVOKABLE static QColor highlight(QQuickPalette *palette); + Q_INVOKABLE static QColor highlightedText(QQuickPalette *palette); + Q_INVOKABLE static QColor outline(QQuickPalette *palette); + Q_INVOKABLE static QColor highlightedOutline(QQuickPalette *palette); + Q_INVOKABLE static QColor tabFrameColor(QQuickPalette *palette); + Q_INVOKABLE static QColor buttonColor(QQuickPalette *palette, bool highlighted = false, bool down = false, bool hovered = false); + Q_INVOKABLE static QColor buttonOutline(QQuickPalette *palette, bool highlighted = false, bool enabled = true); Q_INVOKABLE static QColor gradientStart(const QColor &baseColor); Q_INVOKABLE static QColor gradientStop(const QColor &baseColor); Q_INVOKABLE static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50); - Q_INVOKABLE static QColor grooveColor(const QPalette &palette); + Q_INVOKABLE static QColor grooveColor(QQuickPalette *palette); }; QT_END_NAMESPACE diff --git a/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp b/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp index dcba73fe..985945cf 100644 --- a/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp +++ b/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp @@ -73,10 +73,10 @@ QtQuickControls2FusionStylePlugin::QtQuickControls2FusionStylePlugin(QObject *pa void QtQuickControls2FusionStylePlugin::registerTypes(const char *uri) { qmlRegisterModule(uri, 2, 3); // Qt 5.10->2.3 - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(uri, 2, 15); // Qt 5.12->2.12, 5.13->2.13... QByteArray import = QByteArray(uri) + ".impl"; - qmlRegisterModule(import, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(import, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterSingletonType<QQuickFusionStyle>(import, 2, 3, "Fusion", styleSingleton); diff --git a/src/imports/controls/imagine/.prev_CMakeLists.txt b/src/imports/controls/imagine/.prev_CMakeLists.txt new file mode 100644 index 00000000..5533f872 --- /dev/null +++ b/src/imports/controls/imagine/.prev_CMakeLists.txt @@ -0,0 +1,274 @@ +# Generated from imagine.pro. + +##################################################################### +## qtquickcontrols2imaginestyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2imaginestyleplugin + TARGET_PATH "QtQuick/Controls.2/Imagine" + URI "QtQuick.Controls.Imagine" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2ImagineStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickimageselector.cpp qquickimageselector_p.h + qquickimaginestyle.cpp qquickimaginestyle_p.h + qquickimaginetheme.cpp qquickimaginetheme_p.h + qquickninepatchimage.cpp qquickninepatchimage_p.h + qtquickcontrols2imaginestyleplugin.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 +) + +file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "images/*.png") +foreach(file IN LISTS resource_glob_0) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "images/*.webp") +foreach(file IN LISTS resource_glob_1) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +# Resources: +set(qmake_qtquickcontrols2imaginestyle_resource_files + ${resource_glob_0} + ${resource_glob_1} + "shaders/+glslcore/OpacityMask.frag" + "shaders/+qsb/OpacityMask.frag" + "shaders/OpacityMask.frag" +) + +qt_add_resource(qtquickcontrols2imaginestyleplugin "qmake_qtquickcontrols2imaginestyle" + PREFIX + "qt-project.org/imports/QtQuick/Controls.2/Imagine" + FILES + ${qmake_qtquickcontrols2imaginestyle_resource_files} +) + + +#### Keys ignored in scope 1:.:.:imagine.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Imagine" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Imagine" +# _REQUIREMENTS = "qtConfig(quickcontrols2-imagine)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "OpacityMask.qml" + "PageIndicator.qml" + "Page.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwipeView.qml" + "Switch.qml" + "SwitchDelegate.qml" + "TextField.qml" + "TextArea.qml" + "TabBar.qml" + "TabButton.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +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(CheckDelegate.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(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(OpacityMask.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.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(ScrollIndicator.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(StackView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.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(TextArea.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2imaginestyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/imagine/CMakeLists.txt b/src/imports/controls/imagine/CMakeLists.txt new file mode 100644 index 00000000..5533f872 --- /dev/null +++ b/src/imports/controls/imagine/CMakeLists.txt @@ -0,0 +1,274 @@ +# Generated from imagine.pro. + +##################################################################### +## qtquickcontrols2imaginestyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2imaginestyleplugin + TARGET_PATH "QtQuick/Controls.2/Imagine" + URI "QtQuick.Controls.Imagine" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2ImagineStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickimageselector.cpp qquickimageselector_p.h + qquickimaginestyle.cpp qquickimaginestyle_p.h + qquickimaginetheme.cpp qquickimaginetheme_p.h + qquickninepatchimage.cpp qquickninepatchimage_p.h + qtquickcontrols2imaginestyleplugin.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 +) + +file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "images/*.png") +foreach(file IN LISTS resource_glob_0) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "images/*.webp") +foreach(file IN LISTS resource_glob_1) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + +# Resources: +set(qmake_qtquickcontrols2imaginestyle_resource_files + ${resource_glob_0} + ${resource_glob_1} + "shaders/+glslcore/OpacityMask.frag" + "shaders/+qsb/OpacityMask.frag" + "shaders/OpacityMask.frag" +) + +qt_add_resource(qtquickcontrols2imaginestyleplugin "qmake_qtquickcontrols2imaginestyle" + PREFIX + "qt-project.org/imports/QtQuick/Controls.2/Imagine" + FILES + ${qmake_qtquickcontrols2imaginestyle_resource_files} +) + + +#### Keys ignored in scope 1:.:.:imagine.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Imagine" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Imagine" +# _REQUIREMENTS = "qtConfig(quickcontrols2-imagine)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "OpacityMask.qml" + "PageIndicator.qml" + "Page.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwipeView.qml" + "Switch.qml" + "SwitchDelegate.qml" + "TextField.qml" + "TextArea.qml" + "TabBar.qml" + "TabButton.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +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(CheckDelegate.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(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(OpacityMask.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.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(ScrollIndicator.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(StackView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.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(TextArea.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2imaginestyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml index 92937826..d657e734 100644 --- a/src/imports/controls/imagine/ComboBox.qml +++ b/src/imports/controls/imagine/ComboBox.qml @@ -59,7 +59,7 @@ T.ComboBox { bottomInset: background ? -background.bottomInset || 0 : 0 delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/imagine/DelayButton.qml b/src/imports/controls/imagine/DelayButton.qml index f60b5eae..ed4ad1e5 100644 --- a/src/imports/controls/imagine/DelayButton.qml +++ b/src/imports/controls/imagine/DelayButton.qml @@ -38,7 +38,6 @@ import QtQuick 2.12 import QtQuick.Templates 2.12 as T import QtQuick.Controls.Imagine 2.12 import QtQuick.Controls.Imagine.impl 2.12 -import QtGraphicalEffects 1.12 T.DelayButton { id: control diff --git a/src/imports/controls/imagine/Dial.qml b/src/imports/controls/imagine/Dial.qml index f8c394f3..83daf14a 100644 --- a/src/imports/controls/imagine/Dial.qml +++ b/src/imports/controls/imagine/Dial.qml @@ -58,8 +58,8 @@ T.Dial { bottomInset: background ? -background.bottomInset || 0 : 0 handle: Image { - x: background.x + background.width / 2 - handle.width / 2 - y: background.y + background.height / 2 - handle.height / 2 + x: background.x + background.width / 2 - width / 2 + y: background.y + background.height / 2 - height / 2 source: Imagine.url + "dial-handle" ImageSelector on source { diff --git a/src/imports/controls/imagine/OpacityMask.qml b/src/imports/controls/imagine/OpacityMask.qml new file mode 100644 index 00000000..040bdcf4 --- /dev/null +++ b/src/imports/controls/imagine/OpacityMask.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 + +/* + A cross-graphics API implementation of QtGraphicalEffects' OpacityMask. + */ +Item { + id: rootItem + + property variant source + property variant maskSource + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: rootItem.source + property variant maskSource: rootItem.maskSource + + anchors.fill: parent + + fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Imagine/shaders/OpacityMask.frag" + } +} diff --git a/src/imports/controls/imagine/ProgressBar.qml b/src/imports/controls/imagine/ProgressBar.qml index 2f78004e..69d352eb 100644 --- a/src/imports/controls/imagine/ProgressBar.qml +++ b/src/imports/controls/imagine/ProgressBar.qml @@ -38,7 +38,6 @@ import QtQuick 2.12 import QtQuick.Templates 2.12 as T import QtQuick.Controls.Imagine 2.12 import QtQuick.Controls.Imagine.impl 2.12 -import QtGraphicalEffects 1.12 T.ProgressBar { id: control diff --git a/src/imports/controls/imagine/Tumbler.qml b/src/imports/controls/imagine/Tumbler.qml index 12025cc5..b53b6265 100644 --- a/src/imports/controls/imagine/Tumbler.qml +++ b/src/imports/controls/imagine/Tumbler.qml @@ -45,9 +45,9 @@ T.Tumbler { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) topInset: background ? -background.topInset || 0 : 0 leftInset: background ? -background.leftInset || 0 : 0 diff --git a/src/imports/controls/imagine/imagine.pri b/src/imports/controls/imagine/imagine.pri index 4c6bcf1b..9033808f 100644 --- a/src/imports/controls/imagine/imagine.pri +++ b/src/imports/controls/imagine/imagine.pri @@ -18,6 +18,7 @@ QML_FILES += \ $$PWD/Menu.qml \ $$PWD/MenuItem.qml \ $$PWD/MenuSeparator.qml \ + $$PWD/OpacityMask.qml \ $$PWD/PageIndicator.qml \ $$PWD/Page.qml \ $$PWD/Pane.qml \ diff --git a/src/imports/controls/imagine/imagine.pro b/src/imports/controls/imagine/imagine.pro index f16bd081..66aec543 100644 --- a/src/imports/controls/imagine/imagine.pro +++ b/src/imports/controls/imagine/imagine.pro @@ -21,7 +21,10 @@ SOURCES += \ qtquickcontrols2imaginestyle.prefix = qt-project.org/imports/QtQuick/Controls.2/Imagine qtquickcontrols2imaginestyle.files += \ $$files($$PWD/images/*.png) \ - $$files($$PWD/images/*.webp) + $$files($$PWD/images/*.webp) \ + $$files($$PWD/shaders/OpacityMask.frag) \ + $$files($$PWD/shaders/+glslcore/OpacityMask.frag) \ + $$files($$PWD/shaders/+qsb/OpacityMask.frag) RESOURCES += qtquickcontrols2imaginestyle CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler diff --git a/src/imports/controls/imagine/qmldir b/src/imports/controls/imagine/qmldir index 7b4b3ea0..4319a82c 100644 --- a/src/imports/controls/imagine/qmldir +++ b/src/imports/controls/imagine/qmldir @@ -2,4 +2,3 @@ module QtQuick.Controls.Imagine plugin qtquickcontrols2imaginestyleplugin classname QtQuickControls2ImagineStylePlugin depends QtQuick.Controls 2.5 -depends QtGraphicalEffects 1.0 diff --git a/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp b/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp index 71c013d5..dd20c84b 100644 --- a/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp +++ b/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp @@ -67,16 +67,19 @@ QtQuickControls2ImagineStylePlugin::QtQuickControls2ImagineStylePlugin(QObject * void QtQuickControls2ImagineStylePlugin::registerTypes(const char *uri) { - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(uri, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterUncreatableType<QQuickImagineStyle>(uri, 2, 3, "Imagine", tr("Imagine is an attached property")); QByteArray import = QByteArray(uri) + ".impl"; - qmlRegisterModule(import, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(import, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterType<QQuickAnimatedImageSelector>(import, 2, 3, "AnimatedImageSelector"); qmlRegisterType<QQuickImageSelector>(import, 2, 3, "ImageSelector"); qmlRegisterType<QQuickNinePatchImage>(import, 2, 3, "NinePatchImage"); qmlRegisterType<QQuickNinePatchImageSelector>(import, 2, 3, "NinePatchImageSelector"); + + // Qt 6.0, import version may need to be updated. + qmlRegisterType(resolvedUrl(QStringLiteral("OpacityMask.qml")), import, 2, 0, "OpacityMask"); } QString QtQuickControls2ImagineStylePlugin::name() const diff --git a/src/imports/controls/imagine/shaders/+glslcore/OpacityMask.frag b/src/imports/controls/imagine/shaders/+glslcore/OpacityMask.frag new file mode 100644 index 00000000..529e2696 --- /dev/null +++ b/src/imports/controls/imagine/shaders/+glslcore/OpacityMask.frag @@ -0,0 +1,13 @@ +#version 150 + +uniform float qt_Opacity; +uniform sampler2D source; +uniform sampler2D maskSource; + +in vec2 qt_TexCoord0; +out vec4 fragColor; + +void main() +{ + fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity; +} diff --git a/src/imports/controls/imagine/shaders/+qsb/OpacityMask.frag b/src/imports/controls/imagine/shaders/+qsb/OpacityMask.frag Binary files differnew file mode 100644 index 00000000..331b30b8 --- /dev/null +++ b/src/imports/controls/imagine/shaders/+qsb/OpacityMask.frag diff --git a/src/imports/controls/imagine/shaders/OpacityMask.frag b/src/imports/controls/imagine/shaders/OpacityMask.frag new file mode 100644 index 00000000..84f9bc3e --- /dev/null +++ b/src/imports/controls/imagine/shaders/OpacityMask.frag @@ -0,0 +1,7 @@ +varying highp vec2 qt_TexCoord0; +uniform highp float qt_Opacity; +uniform lowp sampler2D source; +uniform lowp sampler2D maskSource; +void main(void) { + gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity; +} diff --git a/src/imports/controls/imagine/shaders/OpacityMask_rhi.frag b/src/imports/controls/imagine/shaders/OpacityMask_rhi.frag new file mode 100644 index 00000000..9ae32499 --- /dev/null +++ b/src/imports/controls/imagine/shaders/OpacityMask_rhi.frag @@ -0,0 +1,17 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float qt_Opacity; +} ubuf; + +layout(binding = 1) uniform sampler2D source; +layout(binding = 2) uniform sampler2D maskSource; + +void main() +{ + fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * ubuf.qt_Opacity; +} diff --git a/src/imports/controls/imagine/shaders/compile.bat b/src/imports/controls/imagine/shaders/compile.bat new file mode 100644 index 00000000..8f16d7ac --- /dev/null +++ b/src/imports/controls/imagine/shaders/compile.bat @@ -0,0 +1,40 @@ +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Copyright (C) 2020 The Qt Company Ltd. +:: Contact: https://www.qt.io/licensing/ +:: +:: This file is part of the QtQuick module of the Qt Toolkit. +:: +:: $QT_BEGIN_LICENSE:LGPL$ +:: Commercial License Usage +:: Licensees holding valid commercial Qt licenses may use this file in +:: accordance with the commercial license agreement provided with the +:: Software or, alternatively, in accordance with the terms contained in +:: a written agreement between you and The Qt Company. For licensing terms +:: and conditions see https://www.qt.io/terms-conditions. For further +:: information use the contact form at https://www.qt.io/contact-us. +:: +:: GNU Lesser General Public License Usage +:: Alternatively, this file may be used under the terms of the GNU Lesser +:: General Public License version 3 as published by the Free Software +:: Foundation and appearing in the file LICENSE.LGPL3 included in the +:: packaging of this file. Please review the following information to +:: ensure the GNU Lesser General Public License version 3 requirements +:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +:: +:: GNU General Public License Usage +:: Alternatively, this file may be used under the terms of the GNU +:: General Public License version 2.0 or (at your option) the GNU General +:: Public license version 3 or any later version approved by the KDE Free +:: Qt Foundation. The licenses are as published by the Free Software +:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +:: included in the packaging of this file. Please review the following +:: information to ensure the GNU General Public License requirements will +:: be met: https://www.gnu.org/licenses/gpl-2.0.html and +:: https://www.gnu.org/licenses/gpl-3.0.html. +:: +:: $QT_END_LICENSE$ +:: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/OpacityMask.frag OpacityMask_rhi.frag diff --git a/src/imports/controls/material/.prev_CMakeLists.txt b/src/imports/controls/material/.prev_CMakeLists.txt new file mode 100644 index 00000000..15fe3519 --- /dev/null +++ b/src/imports/controls/material/.prev_CMakeLists.txt @@ -0,0 +1,136 @@ +# Generated from material.pro. + +##################################################################### +## qtquickcontrols2materialstyleplugin Plugin: +##################################################################### + +add_qml_module(qtquickcontrols2materialstyleplugin + TARGET_PATH "QtQuick/Controls.2/Material" + URI "QtQuick.Controls.Material" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2MaterialStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickmaterialbusyindicator.cpp qquickmaterialbusyindicator_p.h + qquickmaterialprogressbar.cpp qquickmaterialprogressbar_p.h + qquickmaterialripple.cpp qquickmaterialripple_p.h + qquickmaterialstyle.cpp qquickmaterialstyle_p.h + qquickmaterialtheme.cpp qquickmaterialtheme_p.h + qtquickcontrols2materialstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2materialstyleplugin_resource_files + "images/arrow-indicator.png" + "images/arrow-indicator@2x.png" + "images/arrow-indicator@3x.png" + "images/arrow-indicator@4x.png" + "images/check.png" + "images/check@2x.png" + "images/check@3x.png" + "images/check@4x.png" + "images/drop-indicator.png" + "images/drop-indicator@2x.png" + "images/drop-indicator@3x.png" + "images/drop-indicator@4x.png" + "shaders/+glslcore/RectangularGlow.frag" + "shaders/+hlsl/RectangularGlow.frag" + "shaders/+qsb/RectangularGlow.frag" + "shaders/RectangularGlow.frag" +) + +add_qt_resource(qtquickcontrols2materialstyleplugin "qtquickcontrols2materialstyleplugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Material" + FILES + ${qtquickcontrols2materialstyleplugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:material.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Material" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Material" +# _REQUIREMENTS = "qtConfig(quickcontrols2-material)" + +set(qml_files + "ApplicationWindow.qml" + "BoxShadow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "CursorDelegate.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "ElevationEffect.qml" + "Frame.qml" + "GroupBox.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "RectangularGlow.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SliderHandle.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwipeView.qml" + "Switch.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" +) + +qt6_target_qml_files(qtquickcontrols2materialstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/material/CMakeLists.txt b/src/imports/controls/material/CMakeLists.txt new file mode 100644 index 00000000..1270bfc6 --- /dev/null +++ b/src/imports/controls/material/CMakeLists.txt @@ -0,0 +1,312 @@ +# Generated from material.pro. + +##################################################################### +## qtquickcontrols2materialstyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2materialstyleplugin + TARGET_PATH "QtQuick/Controls.2/Material" + URI "QtQuick.Controls.Material" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2MaterialStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickmaterialbusyindicator.cpp qquickmaterialbusyindicator_p.h + qquickmaterialprogressbar.cpp qquickmaterialprogressbar_p.h + qquickmaterialripple.cpp qquickmaterialripple_p.h + qquickmaterialstyle.cpp qquickmaterialstyle_p.h + qquickmaterialtheme.cpp qquickmaterialtheme_p.h + qtquickcontrols2materialstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2materialstyleplugin_resource_files + "images/arrow-indicator.png" + "images/arrow-indicator@2x.png" + "images/arrow-indicator@3x.png" + "images/arrow-indicator@4x.png" + "images/check.png" + "images/check@2x.png" + "images/check@3x.png" + "images/check@4x.png" + "images/drop-indicator.png" + "images/drop-indicator@2x.png" + "images/drop-indicator@3x.png" + "images/drop-indicator@4x.png" + "shaders/+glslcore/RectangularGlow.frag" + "shaders/+hlsl/RectangularGlow.frag" + "shaders/+qsb/RectangularGlow.frag" + "shaders/RectangularGlow.frag" +) + +qt_add_resource(qtquickcontrols2materialstyleplugin "qtquickcontrols2materialstyleplugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Material" + FILES + ${qtquickcontrols2materialstyleplugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:material.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Material" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Material" +# _REQUIREMENTS = "qtConfig(quickcontrols2-material)" + +set(qml_files + "ApplicationWindow.qml" + "BoxShadow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "CursorDelegate.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "ElevationEffect.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "RectangularGlow.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SliderHandle.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwipeView.qml" + "Switch.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BoxShadow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +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(CheckDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(CheckIndicator.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(CursorDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ElevationEffect.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBarItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RectangularGlow.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(ScrollIndicator.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(SliderHandle.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(StackView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.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 +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2materialstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index e4ee332b..e4e5f935 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -63,7 +63,7 @@ T.ComboBox { Material.foreground: flat ? undefined : Material.primaryTextColor delegate: MenuItem { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData Material.foreground: control.currentIndex === index ? parent.Material.accent : parent.Material.foreground highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml index 1f80a7fe..1ad9a0ce 100644 --- a/src/imports/controls/material/Dial.qml +++ b/src/imports/controls/material/Dial.qml @@ -43,9 +43,9 @@ T.Dial { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) background: Rectangle { implicitWidth: 100 @@ -62,8 +62,8 @@ T.Dial { } handle: SliderHandle { - x: control.background.x + control.background.width / 2 - control.handle.width / 2 - y: control.background.y + control.background.height / 2 - control.handle.height / 2 + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 transform: [ Translate { y: -control.background.height * 0.4 + control.handle.height / 2 diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml index 30d66c58..973b4a68 100644 --- a/src/imports/controls/material/Tumbler.qml +++ b/src/imports/controls/material/Tumbler.qml @@ -44,9 +44,9 @@ T.Tumbler { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) delegate: Text { text: modelData diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp index eb0e6c87..d8cc04dd 100644 --- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp +++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp @@ -68,11 +68,11 @@ QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri) { - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(uri, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 2, 0, "Material", tr("Material is an attached property")); QByteArray import = QByteArray(uri) + ".impl"; - qmlRegisterModule(import, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(import, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterType<QQuickMaterialBusyIndicator>(import, 2, 0, "BusyIndicatorImpl"); qmlRegisterType<QQuickMaterialProgressBar>(import, 2, 0, "ProgressBarImpl"); diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 9fe82ba2..6730848f 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -79,6 +79,7 @@ public: ~QtQuickControls2Plugin(); void registerTypes(const char *uri) override; + void unregisterTypes() override; QString name() const override; void initializeTheme(QQuickTheme *theme) override; @@ -94,7 +95,8 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu QtQuickControls2Plugin::~QtQuickControls2Plugin() { - QQuickStylePrivate::reset(); + // Intentionally empty: we use register/unregisterTypes() to do + // initialization and cleanup, as plugins are not unloaded on macOS. } static bool isDefaultStyle(const QString &style) @@ -120,13 +122,9 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) stylePlugin->initializeTheme(theme); qDeleteAll(stylePlugins); - // Register the latest version, even if there are no new types or new revisions for existing types yet. - // Before Qt 5.12, we would do the following: - // - // qmlRegisterModule(uri, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2... - // - // However, we want to align with the rest of Qt Quick which uses Qt's minor version. - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); + // The minor version used to be the current Qt 5 minor. For compatibility it is the last + // Qt 5 release. + qmlRegisterModule(uri, 2, 15); // QtQuick.Controls 2.0 (originally introduced in Qt 5.7) qmlRegisterType(resolvedUrl(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton"); @@ -202,14 +200,10 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType(resolvedUrl(QStringLiteral("HorizontalHeaderView.qml")), uri, 2, 15, "HorizontalHeaderView"); qmlRegisterType(resolvedUrl(QStringLiteral("VerticalHeaderView.qml")), uri, 2, 15, "VerticalHeaderView"); - // Register the latest version, even if there are no new types or new revisions for existing types yet. - // Before Qt 5.12, we would do the following: - // - // qmlRegisterModule(import, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2... - // - // However, we want to align with the rest of Qt Quick which uses Qt's minor version. + // The minor version used to be the current Qt 5 minor. For compatibility it is the last + // Qt 5 release. const QByteArray import = QByteArray(uri) + ".impl"; - qmlRegisterModule(import, 2, QT_VERSION_MINOR); + qmlRegisterModule(import, 2, 15); // QtQuick.Controls.impl 2.0 (Qt 5.7) qmlRegisterType<QQuickDefaultBusyIndicator>(import, 2, 0, "BusyIndicatorImpl"); @@ -246,6 +240,12 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterRevision<QQuickText, 6>(import, 2, 3); } +void QtQuickControls2Plugin::unregisterTypes() +{ + QQuickStylePlugin::unregisterTypes(); + QQuickStylePrivate::reset(); +} + QString QtQuickControls2Plugin::name() const { return QStringLiteral("Default"); diff --git a/src/imports/controls/universal/.prev_CMakeLists.txt b/src/imports/controls/universal/.prev_CMakeLists.txt new file mode 100644 index 00000000..f78b6e49 --- /dev/null +++ b/src/imports/controls/universal/.prev_CMakeLists.txt @@ -0,0 +1,130 @@ +# Generated from universal.pro. + +##################################################################### +## qtquickcontrols2universalstyleplugin Plugin: +##################################################################### + +add_qml_module(qtquickcontrols2universalstyleplugin + TARGET_PATH "QtQuick/Controls.2/Universal" + URI "QtQuick.Controls.Universal" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2UniversalStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickuniversalbusyindicator.cpp qquickuniversalbusyindicator_p.h + qquickuniversalfocusrectangle.cpp qquickuniversalfocusrectangle_p.h + qquickuniversalprogressbar.cpp qquickuniversalprogressbar_p.h + qquickuniversalstyle.cpp qquickuniversalstyle_p.h + qquickuniversaltheme.cpp qquickuniversaltheme_p.h + qtquickcontrols2universalstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2universalstyleplugin_resource_files + "images/checkmark.png" + "images/checkmark@2x.png" + "images/checkmark@3x.png" + "images/checkmark@4x.png" + "images/downarrow.png" + "images/downarrow@2x.png" + "images/downarrow@3x.png" + "images/downarrow@4x.png" + "images/leftarrow.png" + "images/leftarrow@2x.png" + "images/leftarrow@3x.png" + "images/leftarrow@4x.png" + "images/rightarrow.png" + "images/rightarrow@2x.png" + "images/rightarrow@3x.png" + "images/rightarrow@4x.png" +) + +add_qt_resource(qtquickcontrols2universalstyleplugin "qtquickcontrols2universalstyleplugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Universal" + FILES + ${qtquickcontrols2universalstyleplugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:universal.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Universal" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Universal" +# _REQUIREMENTS = "qtConfig(quickcontrols2-universal)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "Switch.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" +) + +qt6_target_qml_files(qtquickcontrols2universalstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/universal/CMakeLists.txt b/src/imports/controls/universal/CMakeLists.txt new file mode 100644 index 00000000..cf0464f3 --- /dev/null +++ b/src/imports/controls/universal/CMakeLists.txt @@ -0,0 +1,288 @@ +# Generated from universal.pro. + +##################################################################### +## qtquickcontrols2universalstyleplugin Plugin: +##################################################################### + +qt_add_qml_module(qtquickcontrols2universalstyleplugin + TARGET_PATH "QtQuick/Controls.2/Universal" + URI "QtQuick.Controls.Universal" + VERSION "2.${CMAKE_PROJECT_VERSION_MINOR}" + CLASSNAME QtQuickControls2UniversalStylePlugin + DEPENDENCIES + QtQuick.Controls/2.5 + SKIP_TYPE_REGISTRATION + SOURCES + qquickuniversalbusyindicator.cpp qquickuniversalbusyindicator_p.h + qquickuniversalfocusrectangle.cpp qquickuniversalfocusrectangle_p.h + qquickuniversalprogressbar.cpp qquickuniversalprogressbar_p.h + qquickuniversalstyle.cpp qquickuniversalstyle_p.h + qquickuniversaltheme.cpp qquickuniversaltheme_p.h + qtquickcontrols2universalstyleplugin.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 +) + +# Resources: +set(qtquickcontrols2universalstyleplugin_resource_files + "images/checkmark.png" + "images/checkmark@2x.png" + "images/checkmark@3x.png" + "images/checkmark@4x.png" + "images/downarrow.png" + "images/downarrow@2x.png" + "images/downarrow@3x.png" + "images/downarrow@4x.png" + "images/leftarrow.png" + "images/leftarrow@2x.png" + "images/leftarrow@3x.png" + "images/leftarrow@4x.png" + "images/rightarrow.png" + "images/rightarrow@2x.png" + "images/rightarrow@3x.png" + "images/rightarrow@4x.png" +) + +qt_add_resource(qtquickcontrols2universalstyleplugin "qtquickcontrols2universalstyleplugin" + PREFIX + "/qt-project.org/imports/QtQuick/Controls.2/Universal" + FILES + ${qtquickcontrols2universalstyleplugin_resource_files} +) + + +#### Keys ignored in scope 1:.:.:universal.pro:<TRUE>: +# IMPORT_NAME = "QtQuick.Controls.Universal" +# IMPORT_VERSION = "2.$$QT_MINOR_VERSION" +# OTHER_FILES = "qmldir" "$$QML_FILES" +# TARGETPATH = "QtQuick/Controls.2/Universal" +# _REQUIREMENTS = "qtConfig(quickcontrols2-universal)" + +set(qml_files + "ApplicationWindow.qml" + "BusyIndicator.qml" + "Button.qml" + "CheckBox.qml" + "CheckDelegate.qml" + "CheckIndicator.qml" + "ComboBox.qml" + "DelayButton.qml" + "Dial.qml" + "Dialog.qml" + "DialogButtonBox.qml" + "Drawer.qml" + "Frame.qml" + "GroupBox.qml" + "HorizontalHeaderView.qml" + "ItemDelegate.qml" + "Label.qml" + "Menu.qml" + "MenuBar.qml" + "MenuBarItem.qml" + "MenuItem.qml" + "MenuSeparator.qml" + "Page.qml" + "PageIndicator.qml" + "Pane.qml" + "Popup.qml" + "ProgressBar.qml" + "RadioButton.qml" + "RadioDelegate.qml" + "RadioIndicator.qml" + "RangeSlider.qml" + "RoundButton.qml" + "ScrollBar.qml" + "ScrollIndicator.qml" + "Slider.qml" + "SpinBox.qml" + "SplitView.qml" + "StackView.qml" + "SwipeDelegate.qml" + "SwitchDelegate.qml" + "SwitchIndicator.qml" + "Switch.qml" + "TabBar.qml" + "TabButton.qml" + "TextArea.qml" + "TextField.qml" + "ToolBar.qml" + "ToolButton.qml" + "ToolSeparator.qml" + "ToolTip.qml" + "Tumbler.qml" + "VerticalHeaderView.qml" +) +set_source_files_properties(ApplicationWindow.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(BusyIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +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(CheckDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(CheckIndicator.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(DelayButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dial.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Dialog.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(DialogButtonBox.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Drawer.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(HorizontalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ItemDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Label.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Menu.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuBarItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuItem.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(MenuSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Page.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(PageIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Pane.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Popup.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(RadioButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RadioIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RangeSlider.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(RoundButton.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(ScrollIndicator.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(SplitView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(StackView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwipeDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchDelegate.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(SwitchIndicator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Switch.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(TabButton.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 +) +set_source_files_properties(ToolBar.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolButton.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolSeparator.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(ToolTip.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(Tumbler.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) +set_source_files_properties(VerticalHeaderView.qml PROPERTIES + QT_QML_SKIP_QMLDIR_ENTRY TRUE +) + +qt6_target_qml_files(qtquickcontrols2universalstyleplugin + FILES + ${qml_files} +) diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index fd2d8935..9b88ccf9 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -56,7 +56,7 @@ T.ComboBox { Universal.theme: editable && activeFocus ? Universal.Light : undefined delegate: ItemDelegate { - width: parent.width + width: ListView.view.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex === index diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml index f45d912e..0d8fcba0 100644 --- a/src/imports/controls/universal/Dial.qml +++ b/src/imports/controls/universal/Dial.qml @@ -42,9 +42,9 @@ T.Dial { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) background: Rectangle { implicitWidth: 100 @@ -64,8 +64,8 @@ T.Dial { implicitWidth: 14 implicitHeight: 14 - x: control.background.x + control.background.width / 2 - control.handle.width / 2 - y: control.background.y + control.background.height / 2 - control.handle.height / 2 + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 radius: width / 2 color: !control.enabled ? control.Universal.baseLowColor : diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml index d0e7b12f..ebbc746d 100644 --- a/src/imports/controls/universal/Tumbler.qml +++ b/src/imports/controls/universal/Tumbler.qml @@ -44,9 +44,9 @@ T.Tumbler { id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6 + implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6 + implicitContentHeight + topPadding + bottomPadding) delegate: Text { text: modelData diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp index 7a999b79..08cd5001 100644 --- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp +++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp @@ -65,11 +65,11 @@ QtQuickControls2UniversalStylePlugin::QtQuickControls2UniversalStylePlugin(QObje void QtQuickControls2UniversalStylePlugin::registerTypes(const char *uri) { - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(uri, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 2, 0, "Universal", tr("Universal is an attached property")); QByteArray import = QByteArray(uri) + ".impl"; - qmlRegisterModule(import, 2, QT_VERSION_MINOR); // Qt 5.12->2.12, 5.13->2.13... + qmlRegisterModule(import, 2, 15); // Qt 5.12->2.12, 5.13->2.13... qmlRegisterType<QQuickUniversalFocusRectangle>(import, 2, 0, "FocusRectangle"); qmlRegisterType<QQuickUniversalBusyIndicator>(import, 2, 0, "BusyIndicatorImpl"); |