diff options
136 files changed, 957 insertions, 293 deletions
@@ -27,7 +27,6 @@ /examples/quickcontrols2/wearable/wearable /tests/auto/accessibility/tst_accessibility -/tests/auto/applicationwindow/tst_applicationwindow /tests/auto/calendar/tst_calendar /tests/auto/controls/default/tst_default /tests/auto/controls/fusion/tst_fusion @@ -35,22 +34,23 @@ /tests/auto/controls/material/tst_material /tests/auto/controls/universal/tst_universal /tests/auto/cursor/tst_cursor -/tests/auto/drawer/tst_drawer /tests/auto/focus/tst_focus /tests/auto/font/tst_font -/tests/auto/menu/tst_menu /tests/auto/palette/tst_palette /tests/auto/platform/tst_platform -/tests/auto/popup/tst_popup /tests/auto/pressandhold/tst_pressandhold +/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow /tests/auto/qquickcolor/tst_qquickcolor +/tests/auto/qquickdrawer/tst_qquickdrawer /tests/auto/qquickiconimage/tst_qquickiconimage /tests/auto/qquickiconlabel/tst_qquickiconlabel /tests/auto/qquickimaginestyle/tst_qquickimaginestyle /tests/auto/qquickmaterialstyle/tst_qquickmaterialstyle /tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf +/tests/auto/qquickmenu/tst_qquickmenu /tests/auto/qquickmenubar/tst_qquickmenubar /tests/auto/qquickninepatchimage/tst_qquickninepatchimage +/tests/auto/qquickpopup/tst_qquickpopup /tests/auto/qquickstyle/tst_qquickstyle /tests/auto/qquickstyleselector/tst_qquickstyleselector /tests/auto/qquickuniversalstyle/tst_qquickuniversalstyle diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml index d331d2b6..84b618e1 100644 --- a/src/imports/controls/ApplicationWindow.qml +++ b/src/imports/controls/ApplicationWindow.qml @@ -43,13 +43,13 @@ import QtQuick.Templates 2.4 as T T.ApplicationWindow { id: window - color: Default.backgroundColor + color: palette.window overlay.modal: Rectangle { - color: Default.overlayModalColor + color: Color.transparent(window.palette.shadow, 0.5) } overlay.modeless: Rectangle { - color: Default.overlayDimColor + color: Color.transparent(window.palette.shadow, 0.12) } } diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index 9562c904..7039dfc9 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -56,8 +56,7 @@ T.Button { icon.width: 24 icon.height: 24 icon.color: control.checked || control.highlighted ? control.palette.brightText : - control.visualFocus ? control.palette.highlight : - control.flat && !control.down ? control.palette.windowText : control.palette.buttonText + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText contentItem: IconLabel { spacing: control.spacing @@ -68,18 +67,16 @@ T.Button { text: control.text font: control.font color: control.checked || control.highlighted ? control.palette.brightText : - control.visualFocus ? control.palette.highlight : - control.flat && !control.down ? control.palette.windowText : control.palette.buttonText + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText } background: Rectangle { implicitWidth: 100 implicitHeight: 40 visible: !control.flat || control.down || control.checked || control.highlighted - color: control.checked || control.highlighted ? - (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.textColor)) : - (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) - border.color: Default.focusColor + color: Color.blend(control.checked || control.highlighted ? control.palette.dark : control.palette.button, + control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight border.width: control.visualFocus ? 2 : 0 } } diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index cee40c21..2b14b7e4 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -82,6 +82,6 @@ T.CheckDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? Default.delegatePressedColor : Default.delegateColor + color: control.down ? control.palette.midlight : control.palette.light } } diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml index 27aa89aa..d79fa55f 100644 --- a/src/imports/controls/CheckIndicator.qml +++ b/src/imports/controls/CheckIndicator.qml @@ -46,19 +46,15 @@ Rectangle { implicitWidth: 28 implicitHeight: 28 - color: control.enabled ? (control.down - ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : Default.backgroundColor) : Default.disabledDarkColor + color: control.down ? control.palette.light : control.palette.base border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus - ? Default.focusColor - : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : "transparent" - opacity: enabled ? 1 : 0.3 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid ColorImage { x: (parent.width - width) / 2 y: (parent.height - height) / 2 - color: control.visualFocus ? Default.focusColor : undefined + defaultColor: "#353637" + color: control.palette.text source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" visible: control.checkState === Qt.Checked } @@ -68,7 +64,7 @@ Rectangle { y: (parent.height - height) / 2 width: 16 height: 3 - color: control.visualFocus ? Default.focusColor : Default.frameDarkColor + color: control.palette.text visible: control.checkState === Qt.PartiallyChecked } } diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 5bbe273b..3bfa2ea7 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -64,7 +64,8 @@ T.ComboBox { indicator: ColorImage { x: control.mirrored ? control.padding : control.width - width - control.padding y: control.topPadding + (control.availableHeight - height) / 2 - color: !control.editable && control.visualFocus ? Default.focusColor : undefined + color: control.palette.dark + defaultColor: "#353637" source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/double-arrow.png" opacity: enabled ? 1 : 0.3 } @@ -84,16 +85,17 @@ T.ComboBox { validator: control.validator font: control.font - color: !control.editable && control.visualFocus ? Default.focusColor : control.palette.text + color: control.editable ? control.palette.text : control.palette.buttonText selectionColor: control.palette.highlight selectedTextColor: control.palette.highlightedText horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter background: Rectangle { - visible: control.editable && !control.flat + visible: control.enabled && control.editable && !control.flat border.width: parent && parent.activeFocus ? 2 : 1 - border.color: parent && parent.activeFocus ? Default.focusColor : Default.buttonColor + border.color: parent && parent.activeFocus ? control.palette.highlight : control.palette.button + color: control.palette.base } } @@ -101,9 +103,8 @@ T.ComboBox { implicitWidth: 140 implicitHeight: 40 - color: !control.editable && control.visualFocus ? (control.pressed ? Default.focusPressedColor : Default.focusLightColor) : - (control.down || popup.visible ? Default.buttonPressedColor : Default.buttonColor) - border.color: Default.focusColor + color: control.down || popup.visible ? control.palette.mid : control.palette.button + border.color: control.palette.highlight border.width: !control.editable && control.visualFocus ? 2 : 0 visible: !control.flat || control.down } @@ -127,7 +128,7 @@ T.ComboBox { width: parent.width height: parent.height color: "transparent" - border.color: Default.frameLightColor + border.color: control.palette.mid } T.ScrollIndicator.vertical: ScrollIndicator { } diff --git a/src/imports/controls/DelayButton.qml b/src/imports/controls/DelayButton.qml index 835d6b25..e879c73f 100644 --- a/src/imports/controls/DelayButton.qml +++ b/src/imports/controls/DelayButton.qml @@ -79,7 +79,7 @@ T.DelayButton { text: control.text font: control.font opacity: enabled ? 1 : 0.3 - color: control.visualFocus ? control.palette.highlight : control.palette.buttonText + color: control.palette.buttonText horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -113,14 +113,15 @@ T.DelayButton { background: Rectangle { implicitWidth: 100 implicitHeight: 40 - color: control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor) - border.color: Default.focusColor + color: Color.blend(control.palette.button, control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight border.width: control.visualFocus ? 2 : 0 - Rectangle { + PaddedRectangle { + padding: control.visualFocus ? 2 : 0 width: control.progress * parent.width height: parent.height - color: control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.textColor) + color: Color.blend(control.palette.dark, control.palette.mid, control.down ? 0.5 : 0.0) } } } diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index cb3b1c1a..6b96187a 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -48,7 +48,7 @@ T.Dial { background: DialImpl { width: control.availableWidth height: control.availableHeight - color: control.visualFocus ? Default.focusColor : Default.frameDarkColor + color: control.visualFocus ? control.palette.highlight : control.palette.dark progress: control.position opacity: control.enabled ? 1 : 0.3 } @@ -59,7 +59,8 @@ T.Dial { y: background.y + background.height / 2 - handle.height / 2 width: 14 height: 10 - color: control.visualFocus ? Default.focusColor : undefined + defaultColor: "#353637" + color: control.visualFocus ? control.palette.highlight : control.palette.dark source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/dial-indicator.png" antialiasing: true opacity: control.enabled ? 1 : 0.3 diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml index 9c19c045..913e23f1 100644 --- a/src/imports/controls/Dialog.qml +++ b/src/imports/controls/Dialog.qml @@ -57,7 +57,8 @@ T.Dialog { padding: 12 background: Rectangle { - border.color: Default.frameDarkColor + color: control.palette.window + border.color: control.palette.dark } header: Label { @@ -70,6 +71,7 @@ T.Dialog { x: 1; y: 1 width: parent.width - 2 height: parent.height - 1 + color: control.palette.window } } @@ -78,10 +80,10 @@ T.Dialog { } T.Overlay.modal: Rectangle { - color: Default.overlayModalColor + color: Color.transparent(control.palette.shadow, 0.5) } T.Overlay.modeless: Rectangle { - color: Default.overlayDimColor + color: Color.transparent(control.palette.shadow, 0.12) } } diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml index ef08eed3..51a5cc49 100644 --- a/src/imports/controls/DialogButtonBox.qml +++ b/src/imports/controls/DialogButtonBox.qml @@ -69,5 +69,6 @@ T.DialogButtonBox { x: 1; y: 1 width: parent.width - 2 height: parent.height - 2 + color: control.palette.window } } diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 9aaf8159..dbafbd92 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -59,21 +59,22 @@ T.Drawer { exit: Transition { SmoothedAnimation { velocity: 5 } } background: Rectangle { + color: control.palette.window Rectangle { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge width: horizontal ? 1 : parent.width height: horizontal ? parent.height : 1 - color: Default.frameDarkColor + color: control.palette.dark x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 } } T.Overlay.modal: Rectangle { - color: Default.overlayModalColor + color: Color.transparent(control.palette.shadow, 0.5) } T.Overlay.modeless: Rectangle { - color: Default.overlayDimColor + color: Color.transparent(control.palette.shadow, 0.12) } } diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml index 896ce9ac..7c8a4db7 100644 --- a/src/imports/controls/Frame.qml +++ b/src/imports/controls/Frame.qml @@ -52,6 +52,6 @@ T.Frame { background: Rectangle { color: "transparent" - border.color: Default.frameLightColor + border.color: control.palette.mid } } diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index dc529bd6..1a481e22 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -72,6 +72,6 @@ T.GroupBox { height: parent.height - control.topPadding + control.padding color: "transparent" - border.color: Default.frameLightColor + border.color: control.palette.mid } } diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml index a03deac0..6367bc86 100644 --- a/src/imports/controls/ItemDelegate.qml +++ b/src/imports/controls/ItemDelegate.qml @@ -72,8 +72,7 @@ T.ItemDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted || control.visualFocus - color: control.visualFocus - ? (control.pressed ? Default.focusPressedColor : Default.delegateFocusColor) - : (control.down ? Default.delegatePressedColor : Default.delegateColor) + color: Color.blend(control.down ? control.palette.midlight : control.palette.light, + control.palette.highlight, control.visualFocus ? 0.15 : 0.0) } } diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml index 448beaca..deadc274 100644 --- a/src/imports/controls/Menu.qml +++ b/src/imports/controls/Menu.qml @@ -66,15 +66,15 @@ T.Menu { background: Rectangle { implicitWidth: 200 implicitHeight: 40 - color: Default.backgroundColor - border.color: Default.frameDarkColor + color: control.palette.window + border.color: control.palette.dark } T.Overlay.modal: Rectangle { - color: Default.overlayModalColor + color: Color.transparent(control.palette.shadow, 0.5) } T.Overlay.modeless: Rectangle { - color: Default.overlayDimColor + color: Color.transparent(control.palette.shadow, 0.12) } } diff --git a/src/imports/controls/MenuBar.qml b/src/imports/controls/MenuBar.qml index bec4c5fb..058c8736 100644 --- a/src/imports/controls/MenuBar.qml +++ b/src/imports/controls/MenuBar.qml @@ -58,6 +58,6 @@ T.MenuBar { background: Rectangle { implicitHeight: 40 - color: Default.delegateColor + color: control.palette.button } } diff --git a/src/imports/controls/MenuBarItem.qml b/src/imports/controls/MenuBarItem.qml index dd890de5..02e3ac43 100644 --- a/src/imports/controls/MenuBarItem.qml +++ b/src/imports/controls/MenuBarItem.qml @@ -56,7 +56,7 @@ T.MenuBarItem { icon.width: 24 icon.height: 24 - icon.color: enabled ? Default.textDarkColor : Default.textDisabledColor + icon.color: control.palette.buttonText contentItem: IconLabel { spacing: control.spacing @@ -67,12 +67,12 @@ T.MenuBarItem { icon: control.icon text: control.text font: control.font - color: control.enabled ? Default.textDarkColor : Default.textDisabledColor + color: control.palette.buttonText } background: Rectangle { implicitWidth: 40 implicitHeight: 40 - color: control.highlighted || control.down ? Default.delegatePressedColor : "transparent" + color: control.down || control.highlighted ? control.palette.mid : "transparent" } } diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml index e8d1d426..9737efb0 100644 --- a/src/imports/controls/MenuItem.qml +++ b/src/imports/controls/MenuItem.qml @@ -54,7 +54,7 @@ T.MenuItem { icon.width: 24 icon.height: 24 - icon.color: enabled ? Default.textDarkColor : Default.textDisabledColor + icon.color: control.palette.windowText contentItem: IconLabel { readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0 @@ -79,7 +79,8 @@ T.MenuItem { visible: control.checked source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" : "" - color: control.enabled ? undefined : Default.textDisabledColor + color: control.palette.windowText + defaultColor: "#353637" } arrow: ColorImage { @@ -89,7 +90,8 @@ T.MenuItem { visible: control.subMenu mirror: control.mirrored source: control.subMenu ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/arrow-indicator.png" : "" - color: control.enabled ? undefined : Default.textDisabledColor + color: control.palette.windowText + defaultColor: "#353637" } background: Item { @@ -101,7 +103,7 @@ T.MenuItem { y: 1 width: parent.width - 2 height: parent.height - 2 - color: control.highlighted || control.down ? Default.delegateColor : "transparent" + color: control.down ? control.palette.midlight : control.highlighted ? control.palette.light : "transparent" } } } diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml index 42dd64be..ac47e32c 100644 --- a/src/imports/controls/MenuSeparator.qml +++ b/src/imports/controls/MenuSeparator.qml @@ -52,6 +52,6 @@ T.MenuSeparator { contentItem: Rectangle { implicitWidth: 188 implicitHeight: 1 - color: Default.separatorColor + color: control.palette.mid } } diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml index aecc444f..df56dcbe 100644 --- a/src/imports/controls/Page.qml +++ b/src/imports/controls/Page.qml @@ -55,6 +55,6 @@ T.Page { contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) background: Rectangle { - color: Default.backgroundColor + color: control.palette.window } } diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index 8145c3c6..7517e2f2 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -51,6 +51,6 @@ T.Pane { padding: 12 background: Rectangle { - color: Default.backgroundColor + color: control.palette.window } } diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml index cb419f55..7ea706ed 100644 --- a/src/imports/controls/Popup.qml +++ b/src/imports/controls/Popup.qml @@ -53,14 +53,15 @@ T.Popup { padding: 12 background: Rectangle { - border.color: Default.frameDarkColor + color: control.palette.window + border.color: control.palette.dark } T.Overlay.modal: Rectangle { - color: Default.overlayModalColor + color: Color.transparent(control.palette.shadow, 0.5) } T.Overlay.modeless: Rectangle { - color: Default.overlayDimColor + color: Color.transparent(control.palette.shadow, 0.12) } } diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml index 8fa7ba21..7ac857b5 100644 --- a/src/imports/controls/ProgressBar.qml +++ b/src/imports/controls/ProgressBar.qml @@ -64,6 +64,6 @@ T.ProgressBar { width: control.availableWidth height: 6 - color: control.palette.light + color: control.palette.midlight } } diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml index 9a84685d..f1bcc839 100644 --- a/src/imports/controls/RadioDelegate.qml +++ b/src/imports/controls/RadioDelegate.qml @@ -82,6 +82,6 @@ T.RadioDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? Default.delegatePressedColor : Default.delegateColor + color: control.down ? control.palette.midlight : control.palette.light } } diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml index a0cf06d3..f5da9792 100644 --- a/src/imports/controls/RadioIndicator.qml +++ b/src/imports/controls/RadioIndicator.qml @@ -43,12 +43,9 @@ Rectangle { implicitHeight: 28 radius: width / 2 - color: control.down - ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor) + color: control.down ? control.palette.light : control.palette.base border.width: control.visualFocus ? 2 : 1 - border.color: control.visualFocus ? Default.focusColor : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor) - opacity: enabled ? 1 : 0.3 + border.color: control.visualFocus ? control.palette.highlight : control.palette.mid property Item control @@ -58,7 +55,7 @@ Rectangle { width: 20 height: 20 radius: width / 2 - color: control.down ? Default.textDarkColor : Default.buttonCheckedColor + color: control.palette.text visible: control.checked } } diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index c2b2edb6..f2c9266e 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -58,12 +58,8 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus - ? Default.focusColor - : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor - color: control.enabled ? (first.pressed - ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor + border.color: activeFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + color: control.first.pressed ? control.palette.light : control.palette.window } second.handle: Rectangle { @@ -73,12 +69,8 @@ T.RangeSlider { implicitHeight: 28 radius: width / 2 border.width: activeFocus ? 2 : 1 - border.color: control.enabled ? (activeFocus - ? Default.focusColor - : (control.second.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor - color: control.enabled ? (second.pressed - ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor + border.color: activeFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight + color: control.second.pressed ? control.palette.light : control.palette.window } background: Rectangle { @@ -89,7 +81,7 @@ T.RangeSlider { width: control.horizontal ? control.availableWidth : implicitWidth height: control.horizontal ? implicitHeight : control.availableHeight radius: 3 - color: Default.buttonColor + color: control.palette.midlight scale: control.horizontal && control.mirrored ? -1 : 1 Rectangle { @@ -98,7 +90,7 @@ T.RangeSlider { width: control.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 6 : 6 height: control.horizontal ? 6 : control.second.position * parent.height - control.first.position * parent.height - 6 - color: Default.textColor + color: control.palette.dark } } } diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml index f4431132..9692b9de 100644 --- a/src/imports/controls/RoundButton.qml +++ b/src/imports/controls/RoundButton.qml @@ -54,8 +54,7 @@ T.RoundButton { icon.width: 24 icon.height: 24 icon.color: control.checked || control.highlighted ? control.palette.brightText : - control.visualFocus ? control.palette.highlight : - control.flat && !control.down ? control.palette.windowText : control.palette.buttonText + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText contentItem: IconLabel { spacing: control.spacing @@ -66,8 +65,7 @@ T.RoundButton { text: control.text font: control.font color: control.checked || control.highlighted ? control.palette.brightText : - control.visualFocus ? control.palette.highlight : - control.flat && !control.down ? control.palette.windowText : control.palette.buttonText + control.flat && !control.down ? (control.visualFocus ? control.palette.highlight : control.palette.windowText) : control.palette.buttonText } background: Rectangle { @@ -76,10 +74,9 @@ T.RoundButton { radius: control.radius opacity: enabled ? 1 : 0.3 visible: !control.flat || control.down || control.checked || control.highlighted - color: control.checked || control.highlighted ? - (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.buttonCheckedColor)) : - (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor)) - border.color: Default.focusColor + color: Color.blend(control.checked || control.highlighted ? control.palette.dark : control.palette.button, + control.palette.mid, control.down ? 0.5 : 0.0) + border.color: control.palette.highlight border.width: control.visualFocus ? 2 : 0 } } diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml index 56467ffa..b67a2564 100644 --- a/src/imports/controls/ScrollBar.qml +++ b/src/imports/controls/ScrollBar.qml @@ -57,7 +57,7 @@ T.ScrollBar { implicitHeight: control.interactive ? 6 : 2 radius: width / 2 - color: control.pressed ? Default.scrollBarPressedColor : Default.scrollBarColor + color: control.pressed ? control.palette.dark : control.palette.mid opacity: 0.0 states: State { diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml index 048a5749..0025d489 100644 --- a/src/imports/controls/ScrollIndicator.qml +++ b/src/imports/controls/ScrollIndicator.qml @@ -55,7 +55,7 @@ T.ScrollIndicator { implicitWidth: 2 implicitHeight: 2 - color: Default.scrollBarColor + color: control.palette.mid visible: control.size < 1.0 opacity: 0.0 diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index a3cd0f5f..9d4942c9 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -55,13 +55,9 @@ T.Slider { implicitWidth: 28 implicitHeight: 28 radius: width / 2 - color: control.enabled ? (control.pressed - ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor + color: control.pressed ? control.palette.light : control.palette.window border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus - ? Default.focusColor - : (control.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight } background: Rectangle { @@ -72,7 +68,7 @@ T.Slider { width: control.horizontal ? control.availableWidth : implicitWidth height: control.horizontal ? implicitHeight : control.availableHeight radius: 3 - color: Default.buttonColor + color: control.palette.midlight scale: control.horizontal && control.mirrored ? -1 : 1 Rectangle { @@ -81,7 +77,7 @@ T.Slider { height: control.horizontal ? 6 : control.position * parent.height radius: 3 - color: Default.textColor + color: control.palette.dark } } } diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml index 0855d2f0..d74c836a 100644 --- a/src/imports/controls/SpinBox.qml +++ b/src/imports/controls/SpinBox.qml @@ -84,7 +84,7 @@ T.SpinBox { height: control.height visible: control.activeFocus color: "transparent" - border.color: Default.focusColor + border.color: control.palette.highlight border.width: 2 } } @@ -94,21 +94,21 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: up.pressed ? Default.buttonPressedColor : Default.buttonColor + color: up.pressed ? control.palette.mid : control.palette.button Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? Default.textColor : Default.textDisabledColor + color: enabled ? control.palette.buttonText : control.palette.mid } Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: 2 height: parent.width / 3 - color: enabled ? Default.textColor : Default.textDisabledColor + color: enabled ? control.palette.buttonText : control.palette.mid } } @@ -117,19 +117,20 @@ T.SpinBox { height: parent.height implicitWidth: 40 implicitHeight: 40 - color: down.pressed ? Default.buttonPressedColor : Default.buttonColor + color: down.pressed ? control.palette.mid : control.palette.button Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: parent.width / 3 height: 2 - color: enabled ? Default.textColor : Default.textDisabledColor + color: enabled ? control.palette.buttonText : control.palette.mid } } background: Rectangle { implicitWidth: 140 - border.color: Default.buttonColor + color: enabled ? control.palette.base : control.palette.button + border.color: control.palette.button } } diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml index bed2ed03..4f2c9ee1 100644 --- a/src/imports/controls/SwipeDelegate.qml +++ b/src/imports/controls/SwipeDelegate.qml @@ -73,8 +73,7 @@ T.SwipeDelegate { background: Rectangle { implicitWidth: 100 implicitHeight: 40 - color: control.visualFocus - ? (control.down ? Default.focusPressedColor : Default.delegateFocusColor) - : (control.down ? Default.delegatePressedColor : Default.backgroundColor) + color: Color.blend(control.down ? control.palette.midlight : control.palette.light, + control.palette.highlight, control.visualFocus ? 0.15 : 0.0) } } diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml index 4fb5fa5c..0caa6fc5 100644 --- a/src/imports/controls/SwitchDelegate.qml +++ b/src/imports/controls/SwitchDelegate.qml @@ -81,6 +81,6 @@ T.SwitchDelegate { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted - color: control.down ? Default.delegatePressedColor : Default.delegateColor + color: control.down ? control.palette.midlight : control.palette.light } } diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml index d5f97567..6b38709f 100644 --- a/src/imports/controls/SwitchIndicator.qml +++ b/src/imports/controls/SwitchIndicator.qml @@ -49,9 +49,7 @@ Item { width: 56 height: 16 radius: 8 - color: control.checked ? (control.visualFocus ? Default.focusColor : Default.buttonCheckedColor) : Default.buttonColor - border.width: control.visualFocus ? 2 : 0 - border.color: Default.focusColor + color: control.checked ? control.palette.dark : control.palette.midlight } Rectangle { @@ -60,13 +58,9 @@ Item { width: 28 height: 28 radius: 16 - color: control.enabled ? (control.down - ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor) - : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor + color: control.down ? control.palette.light : control.palette.window border.width: control.visualFocus ? 2 : 1 - border.color: control.enabled ? (control.visualFocus - ? Default.focusColor - : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor + border.color: control.visualFocus ? control.palette.highlight : control.enabled ? control.palette.mid : control.palette.midlight Behavior on x { enabled: !control.down diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml index 13866a73..d95d7f39 100644 --- a/src/imports/controls/TabBar.qml +++ b/src/imports/controls/TabBar.qml @@ -63,5 +63,7 @@ T.TabBar { preferredHighlightEnd: width - 40 } - background: Rectangle { } + background: Rectangle { + color: control.palette.window + } } diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml index cd343262..964f4e1f 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -53,7 +53,7 @@ T.TabButton { icon.width: 24 icon.height: 24 - icon.color: Color.transparent(!checked ? Default.textLightColor : down ? Default.textDarkColor : Default.textColor, enabled ? 1 : 0.3) + icon.color: checked ? control.palette.windowText : control.palette.brightText contentItem: IconLabel { spacing: control.spacing @@ -63,14 +63,12 @@ T.TabButton { icon: control.icon text: control.text font: control.font - color: Color.transparent(!control.checked ? Default.textLightColor : control.down ? Default.textDarkColor : Default.textColor, - enabled ? 1 : 0.3) + color: checked ? control.palette.windowText : control.palette.brightText } background: Rectangle { implicitHeight: 40 - color: control.down - ? (control.checked ? Default.tabButtonCheckedPressedColor : Default.tabButtonPressedColor) - : (control.checked ? "transparent" : Default.tabButtonColor) + color: Color.blend(control.checked ? control.palette.window : control.palette.dark, + control.palette.mid, control.down ? 0.5 : 0.0) } } diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml index af705c43..00a97957 100644 --- a/src/imports/controls/TextArea.qml +++ b/src/imports/controls/TextArea.qml @@ -65,7 +65,8 @@ T.TextArea { text: control.placeholderText font: control.font - color: enabled ? Default.textPlaceholderColor : Default.textDisabledColor + opacity: 0.5 + color: control.palette.text verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index 7a8ffe45..333c5bba 100644 --- a/src/imports/controls/TextField.qml +++ b/src/imports/controls/TextField.qml @@ -66,7 +66,8 @@ T.TextField { text: control.placeholderText font: control.font - color: enabled ? Default.textPlaceholderColor : Default.textDisabledColor + opacity: 0.5 + color: control.palette.text verticalAlignment: control.verticalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight @@ -76,7 +77,7 @@ T.TextField { implicitWidth: 200 implicitHeight: 40 border.width: control.activeFocus ? 2 : 1 - color: control.enabled ? Default.backgroundColor : Default.indicatorFrameDisabledColor - border.color: control.activeFocus ? Default.focusColor : (control.enabled ? Default.disabledLightColor : "transparent") + color: control.palette.base + border.color: control.activeFocus ? control.palette.highlight : control.palette.mid } } diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml index ea7274a9..ba6684b9 100644 --- a/src/imports/controls/ToolBar.qml +++ b/src/imports/controls/ToolBar.qml @@ -50,6 +50,6 @@ T.ToolBar { background: Rectangle { implicitHeight: 40 - color: Default.delegateColor + color: control.palette.button } } diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index abe0a225..371d1546 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -53,7 +53,7 @@ T.ToolButton { icon.width: 24 icon.height: 24 - icon.color: enabled ? (visualFocus ? Default.focusColor : Default.textDarkColor) : Default.textDisabledLightColor + icon.color: visualFocus ? control.palette.highlight : control.palette.buttonText contentItem: IconLabel { spacing: control.spacing @@ -63,15 +63,14 @@ T.ToolButton { icon: control.icon text: control.text font: control.font - color: control.enabled ? (control.visualFocus ? Default.focusColor : Default.textDarkColor) : Default.textDisabledLightColor + color: control.visualFocus ? control.palette.highlight : control.palette.buttonText } background: Rectangle { implicitWidth: 40 implicitHeight: 40 - color: Qt.darker(Default.toolButtonColor, control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) - opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0 - visible: control.down || (control.enabled && (control.checked || control.highlighted)) + opacity: control.down ? 1.0 : 0.5 + color: control.down || control.checked || control.highlighted ? control.palette.mid : control.palette.button } } diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml index 36e6286f..306ca575 100644 --- a/src/imports/controls/ToolSeparator.qml +++ b/src/imports/controls/ToolSeparator.qml @@ -52,6 +52,6 @@ T.ToolSeparator { contentItem: Rectangle { implicitWidth: vertical ? 1 : 30 implicitHeight: vertical ? 30 : 1 - color: Default.separatorColor + color: control.palette.mid } } diff --git a/src/imports/controls/doc/images/qtquickcontrols2-styles.png b/src/imports/controls/doc/images/qtquickcontrols2-styles.png Binary files differindex aae046fd..39626e50 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-styles.png +++ b/src/imports/controls/doc/images/qtquickcontrols2-styles.png diff --git a/src/imports/controls/imagine/design/imagine.sketch b/src/imports/controls/imagine/design/imagine.sketch Binary files differnew file mode 100644 index 00000000..eab0877b --- /dev/null +++ b/src/imports/controls/imagine/design/imagine.sketch diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index d5bdfefe..eba8e74e 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -70,14 +70,11 @@ Module { isSingleton: true exportMetaObjectRevisions: [0] Property { name: "backgroundColor"; type: "QColor"; isReadonly: true } - Property { name: "overlayModalColor"; type: "QColor"; isReadonly: true } - Property { name: "overlayDimColor"; type: "QColor"; isReadonly: true } Property { name: "textColor"; type: "QColor"; isReadonly: true } Property { name: "textDarkColor"; type: "QColor"; isReadonly: true } Property { name: "textLightColor"; type: "QColor"; isReadonly: true } Property { name: "textDisabledColor"; type: "QColor"; isReadonly: true } Property { name: "textDisabledLightColor"; type: "QColor"; isReadonly: true } - Property { name: "focusColor"; type: "QColor"; isReadonly: true } Property { name: "focusLightColor"; type: "QColor"; isReadonly: true } Property { name: "focusPressedColor"; type: "QColor"; isReadonly: true } Property { name: "buttonColor"; type: "QColor"; isReadonly: true } @@ -101,7 +98,6 @@ Module { Property { name: "frameLightColor"; type: "QColor"; isReadonly: true } Property { name: "scrollBarColor"; type: "QColor"; isReadonly: true } Property { name: "scrollBarPressedColor"; type: "QColor"; isReadonly: true } - Property { name: "separatorColor"; type: "QColor"; isReadonly: true } Property { name: "disabledDarkColor"; type: "QColor"; isReadonly: true } Property { name: "disabledLightColor"; type: "QColor"; isReadonly: true } } diff --git a/src/imports/controls/qquickdefaultstyle.cpp b/src/imports/controls/qquickdefaultstyle.cpp index 3f91eb58..15c59798 100644 --- a/src/imports/controls/qquickdefaultstyle.cpp +++ b/src/imports/controls/qquickdefaultstyle.cpp @@ -73,6 +73,16 @@ QColor QQuickDefaultStyle::textLightColor() const return QColor::fromRgba(0xFFFFFFFF); } +QColor QQuickDefaultStyle::textLinkColor() const +{ + return QColor::fromRgba(0xFF45A7D7); +} + +QColor QQuickDefaultStyle::textSelectionColor() const +{ + return QColor::fromRgba(0xFFFDDD5C); +} + QColor QQuickDefaultStyle::textDisabledColor() const { return QColor::fromRgba(0xFFBDBEBF); @@ -208,6 +218,16 @@ QColor QQuickDefaultStyle::scrollBarPressedColor() const return QColor::fromRgba(0xFF28282A); } +QColor QQuickDefaultStyle::progressBarColor() const +{ + return QColor::fromRgba(0xFFE4E4E4); +} + +QColor QQuickDefaultStyle::pageIndicatorColor() const +{ + return QColor::fromRgba(0xFF28282A); +} + QColor QQuickDefaultStyle::separatorColor() const { return QColor::fromRgba(0xFFCCCCCC); diff --git a/src/imports/controls/qquickdefaultstyle_p.h b/src/imports/controls/qquickdefaultstyle_p.h index e2f9bf4a..fcd489a0 100644 --- a/src/imports/controls/qquickdefaultstyle_p.h +++ b/src/imports/controls/qquickdefaultstyle_p.h @@ -62,6 +62,8 @@ class QQuickDefaultStyle : public QObject Q_PROPERTY(QColor textColor READ textColor CONSTANT FINAL) Q_PROPERTY(QColor textDarkColor READ textDarkColor CONSTANT FINAL) Q_PROPERTY(QColor textLightColor READ textLightColor CONSTANT FINAL) + Q_PROPERTY(QColor textLinkColor READ textLinkColor CONSTANT FINAL) + Q_PROPERTY(QColor textSelectionColor READ textSelectionColor CONSTANT FINAL) Q_PROPERTY(QColor textDisabledColor READ textDisabledColor CONSTANT FINAL) Q_PROPERTY(QColor textDisabledLightColor READ textDisabledLightColor CONSTANT FINAL) Q_PROPERTY(QColor textPlaceholderColor READ textPlaceholderColor CONSTANT FINAL) @@ -89,6 +91,8 @@ class QQuickDefaultStyle : public QObject Q_PROPERTY(QColor frameLightColor READ frameLightColor CONSTANT FINAL) Q_PROPERTY(QColor scrollBarColor READ scrollBarColor CONSTANT FINAL) Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor CONSTANT FINAL) + Q_PROPERTY(QColor progressBarColor READ progressBarColor CONSTANT FINAL) + Q_PROPERTY(QColor pageIndicatorColor READ pageIndicatorColor CONSTANT FINAL) Q_PROPERTY(QColor separatorColor READ separatorColor CONSTANT FINAL) Q_PROPERTY(QColor disabledDarkColor READ disabledDarkColor CONSTANT FINAL) Q_PROPERTY(QColor disabledLightColor READ disabledLightColor CONSTANT FINAL) @@ -131,6 +135,8 @@ public: QColor frameLightColor() const; QColor scrollBarColor() const; QColor scrollBarPressedColor() const; + QColor progressBarColor() const; + QColor pageIndicatorColor() const; QColor separatorColor() const; QColor disabledDarkColor() const; QColor disabledLightColor() const; diff --git a/src/imports/controls/qquickdefaulttheme.cpp b/src/imports/controls/qquickdefaulttheme.cpp index 60d76556..f4b6f5d7 100644 --- a/src/imports/controls/qquickdefaulttheme.cpp +++ b/src/imports/controls/qquickdefaulttheme.cpp @@ -41,6 +41,11 @@ QT_BEGIN_NAMESPACE QQuickDefaultTheme::QQuickDefaultTheme() : QQuickTheme(QStringLiteral("Default")) { + systemPalette.setColor(QPalette::Base, QColor::fromRgba(0xFFFFFFFF)); + systemPalette.setColor(QPalette::Disabled, QPalette::Base, QColor::fromRgba(0xFFD6D6D6)); + + systemPalette.setColor(QPalette::Button, QColor::fromRgba(0xFFE0E0E0)); + systemPalette.setColor(QPalette::ButtonText, QColor::fromRgba(0xFF26282A)); systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgba(0x4D26282A)); @@ -54,16 +59,24 @@ QQuickDefaultTheme::QQuickDefaultTheme() systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(0xFFFFFFFF)); - systemPalette.setColor(QPalette::Light, QColor::fromRgba(0xFFE4E4E4)); + systemPalette.setColor(QPalette::Light, QColor::fromRgba(0xFFF6F6F6)); systemPalette.setColor(QPalette::Link, QColor::fromRgba(0xFF45A7D7)); + systemPalette.setColor(QPalette::Mid, QColor::fromRgba(0xFFBDBDBD)); + + systemPalette.setColor(QPalette::Midlight, QColor::fromRgba(0xFFE4E4E4)); + systemPalette.setColor(QPalette::Text, QColor::fromRgba(0xFF353637)); - systemPalette.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgba(0xFFC2C2C2)); + systemPalette.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgba(0x7F353637)); + + systemPalette.setColor(QPalette::Shadow, QColor::fromRgba(0xFF28282A)); systemPalette.setColor(QPalette::ToolTipBase, QColor::fromRgba(0xFFFFFFFF)); systemPalette.setColor(QPalette::ToolTipText, QColor::fromRgba(0xFF000000)); + systemPalette.setColor(QPalette::Window, QColor::fromRgba(0xFFFFFFFF)); + systemPalette.setColor(QPalette::WindowText, QColor::fromRgba(0xFF26282A)); systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgba(0xFFBDBEBF)); diff --git a/src/quickcontrols2/qquickcolor.cpp b/src/quickcontrols2/qquickcolor.cpp index bede2a88..66ef21b7 100644 --- a/src/quickcontrols2/qquickcolor.cpp +++ b/src/quickcontrols2/qquickcolor.cpp @@ -48,4 +48,18 @@ QColor QQuickColor::transparent(const QColor &color, qreal opacity) const return QColor(color.red(), color.green(), color.blue(), qBound(0.0, opacity, 1.0) * 255); } +QColor QQuickColor::blend(const QColor &a, const QColor &b, qreal factor) const +{ + if (factor <= 0.0) + return a; + if (factor >= 1.0) + return b; + + QColor color; + color.setRedF(a.redF() * (1.0 - factor) + b.redF() * factor); + color.setGreenF(a.greenF() * (1.0 - factor) + b.greenF() * factor); + color.setBlueF(a.blueF() * (1.0 - factor) + b.blueF() * factor); + return color; +} + QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickcolor_p.h b/src/quickcontrols2/qquickcolor_p.h index 85578359..657a9fa4 100644 --- a/src/quickcontrols2/qquickcolor_p.h +++ b/src/quickcontrols2/qquickcolor_p.h @@ -62,6 +62,7 @@ public: explicit QQuickColor(QObject *parent = nullptr); Q_INVOKABLE QColor transparent(const QColor &color, qreal opacity) const; + Q_INVOKABLE QColor blend(const QColor &a, const QColor &b, qreal factor) const; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickcolorimage.cpp b/src/quickcontrols2/qquickcolorimage.cpp index 9358c3ca..9d24a156 100644 --- a/src/quickcontrols2/qquickcolorimage.cpp +++ b/src/quickcontrols2/qquickcolorimage.cpp @@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE QQuickColorImage::QQuickColorImage(QQuickItem *parent) - : QQuickImage(parent), m_color(Qt::transparent) + : QQuickImage(parent), m_color(Qt::transparent), m_defaultColor(Qt::transparent) { } @@ -66,10 +66,29 @@ void QQuickColorImage::resetColor() setColor(Qt::transparent); } +QColor QQuickColorImage::defaultColor() const +{ + return m_defaultColor; +} + +void QQuickColorImage::setDefaultColor(const QColor &color) +{ + if (m_defaultColor == color) + return; + + m_defaultColor = color; + emit defaultColorChanged(); +} + +void QQuickColorImage::resetDefaultColor() +{ + setDefaultColor(Qt::transparent); +} + void QQuickColorImage::pixmapChange() { QQuickImage::pixmapChange(); - if (m_color.alpha() > 0) { + if (m_color.alpha() > 0 && m_color != m_defaultColor) { QQuickImageBasePrivate *d = static_cast<QQuickImageBasePrivate *>(QQuickItemPrivate::get(this)); QImage image = d->pix.image(); if (!image.isNull()) { diff --git a/src/quickcontrols2/qquickcolorimage_p.h b/src/quickcontrols2/qquickcolorimage_p.h index 6de2e21b..873bc2db 100644 --- a/src/quickcontrols2/qquickcolorimage_p.h +++ b/src/quickcontrols2/qquickcolorimage_p.h @@ -58,6 +58,7 @@ class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickColorImage : public QQuickImage { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor NOTIFY colorChanged FINAL) + Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor RESET resetDefaultColor NOTIFY defaultColorChanged FINAL) public: explicit QQuickColorImage(QQuickItem *parent = nullptr); @@ -66,14 +67,20 @@ public: void setColor(const QColor &color); void resetColor(); + QColor defaultColor() const; + void setDefaultColor(const QColor &color); + void resetDefaultColor(); + Q_SIGNALS: void colorChanged(); + void defaultColorChanged(); protected: void pixmapChange() override; private: QColor m_color; + QColor m_defaultColor; }; QT_END_NAMESPACE diff --git a/src/quickcontrols2/qquickpaddedrectangle.cpp b/src/quickcontrols2/qquickpaddedrectangle.cpp index 3555d6d7..f7088d54 100644 --- a/src/quickcontrols2/qquickpaddedrectangle.cpp +++ b/src/quickcontrols2/qquickpaddedrectangle.cpp @@ -200,7 +200,10 @@ QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeDa m.translate(left, top); transformNode->setMatrix(m); - rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom)); + qreal w = qMax<qreal>(0.0, width() -left-right); + qreal h = qMax<qreal>(0.0, height() -top-bottom); + + rectNode->setRect(QRectF(0, 0, w, h)); rectNode->update(); } } diff --git a/src/quicktemplates2/qquickactiongroup.cpp b/src/quicktemplates2/qquickactiongroup.cpp index 7a5e17ee..92dda52b 100644 --- a/src/quicktemplates2/qquickactiongroup.cpp +++ b/src/quicktemplates2/qquickactiongroup.cpp @@ -156,7 +156,7 @@ public: bool enabled; bool exclusive; - QQuickAction *checkedAction; + QPointer<QQuickAction> checkedAction; QVector<QQuickAction*> actions; }; diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index df6f764e..7dfd552e 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,26 +1,26 @@ TEMPLATE = subdirs SUBDIRS += \ accessibility \ - applicationwindow \ calendar \ controls \ cursor \ - drawer \ focus \ font \ - menu \ palette \ platform \ - popup \ pressandhold \ + qquickapplicationwindow \ qquickcolor \ + qquickdrawer \ qquickiconimage \ qquickiconlabel \ qquickimaginestyle \ qquickmaterialstyle \ qquickmaterialstyleconf \ + qquickmenu \ qquickmenubar \ qquickninepatchimage \ + qquickpopup \ qquickstyle \ qquickstyleselector \ qquickuniversalstyle \ @@ -28,4 +28,3 @@ SUBDIRS += \ revisions \ sanity \ snippets - diff --git a/tests/auto/applicationwindow/data/activeFocusControl.qml b/tests/auto/qquickapplicationwindow/data/activeFocusControl.qml index 940e8e08..940e8e08 100644 --- a/tests/auto/applicationwindow/data/activeFocusControl.qml +++ b/tests/auto/qquickapplicationwindow/data/activeFocusControl.qml diff --git a/tests/auto/applicationwindow/data/activefocusontab.qml b/tests/auto/qquickapplicationwindow/data/activefocusontab.qml index 357ea9a4..357ea9a4 100644 --- a/tests/auto/applicationwindow/data/activefocusontab.qml +++ b/tests/auto/qquickapplicationwindow/data/activefocusontab.qml diff --git a/tests/auto/applicationwindow/data/attachedProperties.qml b/tests/auto/qquickapplicationwindow/data/attachedProperties.qml index 09bc47ef..09bc47ef 100644 --- a/tests/auto/applicationwindow/data/attachedProperties.qml +++ b/tests/auto/qquickapplicationwindow/data/attachedProperties.qml diff --git a/tests/auto/applicationwindow/data/basicapplicationwindow.qml b/tests/auto/qquickapplicationwindow/data/basicapplicationwindow.qml index 16182f59..16182f59 100644 --- a/tests/auto/applicationwindow/data/basicapplicationwindow.qml +++ b/tests/auto/qquickapplicationwindow/data/basicapplicationwindow.qml diff --git a/tests/auto/applicationwindow/data/clearfocusondestruction.qml b/tests/auto/qquickapplicationwindow/data/clearfocusondestruction.qml index 3589439e..3589439e 100644 --- a/tests/auto/applicationwindow/data/clearfocusondestruction.qml +++ b/tests/auto/qquickapplicationwindow/data/clearfocusondestruction.qml diff --git a/tests/auto/applicationwindow/data/defaultFocus.qml b/tests/auto/qquickapplicationwindow/data/defaultFocus.qml index 741ce908..741ce908 100644 --- a/tests/auto/applicationwindow/data/defaultFocus.qml +++ b/tests/auto/qquickapplicationwindow/data/defaultFocus.qml diff --git a/tests/auto/applicationwindow/data/fill.qml b/tests/auto/qquickapplicationwindow/data/fill.qml index 27b10d34..27b10d34 100644 --- a/tests/auto/applicationwindow/data/fill.qml +++ b/tests/auto/qquickapplicationwindow/data/fill.qml diff --git a/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml b/tests/auto/qquickapplicationwindow/data/focusAfterPopupClosed.qml index f0499a3a..f0499a3a 100644 --- a/tests/auto/applicationwindow/data/focusAfterPopupClosed.qml +++ b/tests/auto/qquickapplicationwindow/data/focusAfterPopupClosed.qml diff --git a/tests/auto/applicationwindow/data/font.qml b/tests/auto/qquickapplicationwindow/data/font.qml index a675aeab..a675aeab 100644 --- a/tests/auto/applicationwindow/data/font.qml +++ b/tests/auto/qquickapplicationwindow/data/font.qml diff --git a/tests/auto/applicationwindow/data/layout.qml b/tests/auto/qquickapplicationwindow/data/layout.qml index 5bcffdf1..5bcffdf1 100644 --- a/tests/auto/applicationwindow/data/layout.qml +++ b/tests/auto/qquickapplicationwindow/data/layout.qml diff --git a/tests/auto/applicationwindow/data/locale.qml b/tests/auto/qquickapplicationwindow/data/locale.qml index 92edb53a..92edb53a 100644 --- a/tests/auto/applicationwindow/data/locale.qml +++ b/tests/auto/qquickapplicationwindow/data/locale.qml diff --git a/tests/auto/applicationwindow/applicationwindow.pro b/tests/auto/qquickapplicationwindow/qquickapplicationwindow.pro index f94641c7..775f4c90 100644 --- a/tests/auto/applicationwindow/applicationwindow.pro +++ b/tests/auto/qquickapplicationwindow/qquickapplicationwindow.pro @@ -1,6 +1,6 @@ CONFIG += testcase -TARGET = tst_applicationwindow -SOURCES += tst_applicationwindow.cpp +TARGET = tst_qquickapplicationwindow +SOURCES += tst_qquickapplicationwindow.cpp macos:CONFIG -= app_bundle diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 81cd9886..aeeddb10 100644 --- a/tests/auto/applicationwindow/tst_applicationwindow.cpp +++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -56,7 +56,7 @@ using namespace QQuickVisualTestUtil; -class tst_applicationwindow : public QQmlDataTest +class tst_QQuickApplicationWindow : public QQmlDataTest { Q_OBJECT public: @@ -79,7 +79,7 @@ private slots: void componentComplete(); }; -void tst_applicationwindow::qmlCreation() +void tst_QQuickApplicationWindow::qmlCreation() { QQmlEngine engine; QQmlComponent component(&engine); @@ -104,7 +104,7 @@ void tst_applicationwindow::qmlCreation() QVERIFY(!footer); } -void tst_applicationwindow::activeFocusOnTab1() +void tst_QQuickApplicationWindow::activeFocusOnTab1() { QQmlEngine engine; QQmlComponent component(&engine); @@ -156,7 +156,7 @@ void tst_applicationwindow::activeFocusOnTab1() QVERIFY(item->hasActiveFocus()); } -void tst_applicationwindow::activeFocusOnTab2() +void tst_QQuickApplicationWindow::activeFocusOnTab2() { QQmlEngine engine; QQmlComponent component(&engine); @@ -208,7 +208,7 @@ void tst_applicationwindow::activeFocusOnTab2() QVERIFY(item->hasActiveFocus()); } -void tst_applicationwindow::defaultFocus() +void tst_QQuickApplicationWindow::defaultFocus() { QQmlEngine engine; QQmlComponent component(&engine); @@ -236,7 +236,7 @@ void tst_applicationwindow::defaultFocus() QVERIFY(item->hasActiveFocus()); } -void tst_applicationwindow::implicitFill() +void tst_QQuickApplicationWindow::implicitFill() { QQmlEngine engine; QQmlComponent component(&engine); @@ -267,7 +267,7 @@ void tst_applicationwindow::implicitFill() QCOMPARE(nextItem->height(), 400.0); } -void tst_applicationwindow::attachedProperties() +void tst_QQuickApplicationWindow::attachedProperties() { QQmlEngine engine; QQmlComponent component(&engine); @@ -499,7 +499,7 @@ void tst_applicationwindow::attachedProperties() qApp->processEvents(); } -void tst_applicationwindow::font() +void tst_QQuickApplicationWindow::font() { QQmlEngine engine; QQmlComponent component(&engine); @@ -570,7 +570,7 @@ public: QFont m_font; }; -void tst_applicationwindow::defaultFont() +void tst_QQuickApplicationWindow::defaultFont() { TestTheme theme(QGuiApplicationPrivate::platform_theme); @@ -584,7 +584,7 @@ void tst_applicationwindow::defaultFont() QCOMPARE(window->font(), *theme.font()); } -void tst_applicationwindow::locale() +void tst_QQuickApplicationWindow::locale() { QQmlEngine engine; QQmlComponent component(&engine); @@ -635,7 +635,7 @@ void tst_applicationwindow::locale() QCOMPARE(item3->locale(), l); } -void tst_applicationwindow::activeFocusControl_data() +void tst_QQuickApplicationWindow::activeFocusControl_data() { QTest::addColumn<QByteArray>("containerName"); QTest::addColumn<QByteArray>("activeFocusItemName"); @@ -654,7 +654,7 @@ void tst_applicationwindow::activeFocusControl_data() QTest::newRow("Frame:SpinBox") << QByteArray("container_frame") << QByteArray("spinContent_frame") << QByteArray("spinBox_frame"); } -void tst_applicationwindow::activeFocusControl() +void tst_QQuickApplicationWindow::activeFocusControl() { QFETCH(QByteArray, containerName); QFETCH(QByteArray, activeFocusItemName); @@ -694,7 +694,7 @@ void tst_applicationwindow::activeFocusControl() QCOMPARE(window->activeFocusControl(), activeFocusControl); } -void tst_applicationwindow::focusAfterPopupClosed() +void tst_QQuickApplicationWindow::focusAfterPopupClosed() { QQmlEngine engine; QQmlComponent component(&engine); @@ -772,7 +772,7 @@ void tst_applicationwindow::focusAfterPopupClosed() QCOMPARE(focusScopeSpy.count(), 3); } -void tst_applicationwindow::clearFocusOnDestruction() +void tst_QQuickApplicationWindow::clearFocusOnDestruction() { QQmlEngine engine; QQmlComponent component(&engine); @@ -813,7 +813,7 @@ void tst_applicationwindow::clearFocusOnDestruction() QCOMPARE(spy.count(), 1); } -void tst_applicationwindow::layout() +void tst_QQuickApplicationWindow::layout() { QQmlEngine engine; QQmlComponent component(&engine); @@ -875,10 +875,10 @@ void tst_applicationwindow::layout() class FriendlyApplicationWindow : public QQuickApplicationWindow { - friend class tst_applicationwindow; + friend class tst_QQuickApplicationWindow; }; -void tst_applicationwindow::componentComplete() +void tst_QQuickApplicationWindow::componentComplete() { FriendlyApplicationWindow cppWindow; QVERIFY(cppWindow.isComponentComplete()); @@ -895,6 +895,6 @@ void tst_applicationwindow::componentComplete() QVERIFY(qmlWindow->isComponentComplete()); } -QTEST_MAIN(tst_applicationwindow) +QTEST_MAIN(tst_QQuickApplicationWindow) -#include "tst_applicationwindow.moc" +#include "tst_qquickapplicationwindow.moc" diff --git a/tests/auto/drawer/BLACKLIST b/tests/auto/qquickdrawer/BLACKLIST index b302c76b..b302c76b 100644 --- a/tests/auto/drawer/BLACKLIST +++ b/tests/auto/qquickdrawer/BLACKLIST diff --git a/tests/auto/drawer/data/applicationwindow-button.qml b/tests/auto/qquickdrawer/data/applicationwindow-button.qml index 9641351e..9641351e 100644 --- a/tests/auto/drawer/data/applicationwindow-button.qml +++ b/tests/auto/qquickdrawer/data/applicationwindow-button.qml diff --git a/tests/auto/drawer/data/applicationwindow-hover.qml b/tests/auto/qquickdrawer/data/applicationwindow-hover.qml index 560efec3..560efec3 100644 --- a/tests/auto/drawer/data/applicationwindow-hover.qml +++ b/tests/auto/qquickdrawer/data/applicationwindow-hover.qml diff --git a/tests/auto/drawer/data/applicationwindow-wheel.qml b/tests/auto/qquickdrawer/data/applicationwindow-wheel.qml index 541f08aa..541f08aa 100644 --- a/tests/auto/drawer/data/applicationwindow-wheel.qml +++ b/tests/auto/qquickdrawer/data/applicationwindow-wheel.qml diff --git a/tests/auto/drawer/data/applicationwindow.qml b/tests/auto/qquickdrawer/data/applicationwindow.qml index 673c4d4c..673c4d4c 100644 --- a/tests/auto/drawer/data/applicationwindow.qml +++ b/tests/auto/qquickdrawer/data/applicationwindow.qml diff --git a/tests/auto/drawer/data/dragOverModalShadow.qml b/tests/auto/qquickdrawer/data/dragOverModalShadow.qml index 66eb2f4b..66eb2f4b 100644 --- a/tests/auto/drawer/data/dragOverModalShadow.qml +++ b/tests/auto/qquickdrawer/data/dragOverModalShadow.qml diff --git a/tests/auto/drawer/data/flickable.qml b/tests/auto/qquickdrawer/data/flickable.qml index 62256afd..62256afd 100644 --- a/tests/auto/drawer/data/flickable.qml +++ b/tests/auto/qquickdrawer/data/flickable.qml diff --git a/tests/auto/drawer/data/grabber.qml b/tests/auto/qquickdrawer/data/grabber.qml index e6ebe2da..e6ebe2da 100644 --- a/tests/auto/drawer/data/grabber.qml +++ b/tests/auto/qquickdrawer/data/grabber.qml diff --git a/tests/auto/drawer/data/header.qml b/tests/auto/qquickdrawer/data/header.qml index de3af106..de3af106 100644 --- a/tests/auto/drawer/data/header.qml +++ b/tests/auto/qquickdrawer/data/header.qml diff --git a/tests/auto/drawer/data/multiTouch.qml b/tests/auto/qquickdrawer/data/multiTouch.qml index 0faf3c61..0faf3c61 100644 --- a/tests/auto/drawer/data/multiTouch.qml +++ b/tests/auto/qquickdrawer/data/multiTouch.qml diff --git a/tests/auto/drawer/data/multiple.qml b/tests/auto/qquickdrawer/data/multiple.qml index 4e622fca..4e622fca 100644 --- a/tests/auto/drawer/data/multiple.qml +++ b/tests/auto/qquickdrawer/data/multiple.qml diff --git a/tests/auto/drawer/data/reposition.qml b/tests/auto/qquickdrawer/data/reposition.qml index 485da85c..485da85c 100644 --- a/tests/auto/drawer/data/reposition.qml +++ b/tests/auto/qquickdrawer/data/reposition.qml diff --git a/tests/auto/drawer/data/window-button.qml b/tests/auto/qquickdrawer/data/window-button.qml index 1b8ac7d5..1b8ac7d5 100644 --- a/tests/auto/drawer/data/window-button.qml +++ b/tests/auto/qquickdrawer/data/window-button.qml diff --git a/tests/auto/drawer/data/window-hover.qml b/tests/auto/qquickdrawer/data/window-hover.qml index b35bcd99..b35bcd99 100644 --- a/tests/auto/drawer/data/window-hover.qml +++ b/tests/auto/qquickdrawer/data/window-hover.qml diff --git a/tests/auto/drawer/data/window-wheel.qml b/tests/auto/qquickdrawer/data/window-wheel.qml index 988a541e..988a541e 100644 --- a/tests/auto/drawer/data/window-wheel.qml +++ b/tests/auto/qquickdrawer/data/window-wheel.qml diff --git a/tests/auto/drawer/data/window.qml b/tests/auto/qquickdrawer/data/window.qml index 88376ac4..88376ac4 100644 --- a/tests/auto/drawer/data/window.qml +++ b/tests/auto/qquickdrawer/data/window.qml diff --git a/tests/auto/drawer/drawer.pro b/tests/auto/qquickdrawer/qquickdrawer.pro index 7dfc3638..9df205e6 100644 --- a/tests/auto/drawer/drawer.pro +++ b/tests/auto/qquickdrawer/qquickdrawer.pro @@ -1,6 +1,6 @@ CONFIG += testcase -TARGET = tst_drawer -SOURCES += tst_drawer.cpp +TARGET = tst_qquickdrawer +SOURCES += tst_qquickdrawer.cpp macos:CONFIG -= app_bundle diff --git a/tests/auto/drawer/tst_drawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp index 0bfb3fc9..9f6a556f 100644 --- a/tests/auto/drawer/tst_drawer.cpp +++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp @@ -54,7 +54,7 @@ using namespace QQuickVisualTestUtil; -class tst_Drawer : public QQmlDataTest +class tst_QQuickDrawer : public QQmlDataTest { Q_OBJECT @@ -116,7 +116,7 @@ private: }; -void tst_Drawer::initTestCase() +void tst_QQuickDrawer::initTestCase() { QQmlDataTest::initTestCase(); qputenv("QML_NO_TOUCH_COMPRESSION", "1"); @@ -126,14 +126,14 @@ void tst_Drawer::initTestCase() QWindowSystemInterface::registerTouchDevice(touchDevice.data()); } -void tst_Drawer::visible_data() +void tst_QQuickDrawer::visible_data() { QTest::addColumn<QString>("source"); QTest::newRow("Window") << "window.qml"; QTest::newRow("ApplicationWindow") << "applicationwindow.qml"; } -void tst_Drawer::visible() +void tst_QQuickDrawer::visible() { QFETCH(QString, source); QQuickApplicationHelper helper(this, source); @@ -174,7 +174,7 @@ void tst_Drawer::visible() QTRY_VERIFY(!overlay->childItems().contains(popupItem)); } -void tst_Drawer::state() +void tst_QQuickDrawer::state() { QQuickApplicationHelper helper(this, "applicationwindow.qml"); @@ -274,7 +274,7 @@ void tst_Drawer::state() QCOMPARE(closedSpy.count(), ++closedCount); } -void tst_Drawer::position_data() +void tst_QQuickDrawer::position_data() { QTest::addColumn<Qt::Edge>("edge"); QTest::addColumn<QPoint>("press"); @@ -288,7 +288,7 @@ void tst_Drawer::position_data() QTest::newRow("bottom") << Qt::BottomEdge << QPoint(100, 399) << QPoint(100, 350) << QPoint(150, 250) << qreal(0.5); } -void tst_Drawer::position() +void tst_QQuickDrawer::position() { QFETCH(Qt::Edge, edge); QFETCH(QPoint, press); @@ -317,7 +317,7 @@ void tst_Drawer::position() QTRY_COMPARE(drawer->position(), 1.0); } -void tst_Drawer::dragMargin_data() +void tst_QQuickDrawer::dragMargin_data() { QTest::addColumn<Qt::Edge>("edge"); QTest::addColumn<qreal>("dragMargin"); @@ -335,7 +335,7 @@ void tst_Drawer::dragMargin_data() QTest::newRow("right:startDragDistance*2") << Qt::RightEdge << qreal(QGuiApplication::styleHints()->startDragDistance() * 2) << qreal(0) << qreal(0.75); } -void tst_Drawer::dragMargin() +void tst_QQuickDrawer::dragMargin() { QFETCH(Qt::Edge, edge); QFETCH(qreal, dragMargin); @@ -385,7 +385,7 @@ static QRectF geometry(const QQuickItem *item) return QRectF(item->x(), item->y(), item->width(), item->height()); } -void tst_Drawer::reposition() +void tst_QQuickDrawer::reposition() { QQuickApplicationHelper helper(this, QStringLiteral("reposition.qml")); @@ -443,7 +443,7 @@ void tst_Drawer::reposition() QTRY_COMPARE(popupItem2->x(), 0.0); } -void tst_Drawer::header() +void tst_QQuickDrawer::header() { QQuickApplicationHelper helper(this, QStringLiteral("header.qml")); @@ -483,7 +483,7 @@ void tst_Drawer::header() QCOMPARE(clickSpy.count(), 1); } -void tst_Drawer::hover_data() +void tst_QQuickDrawer::hover_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("modal"); @@ -494,7 +494,7 @@ void tst_Drawer::hover_data() QTest::newRow("ApplicationWindow:modeless") << "applicationwindow-hover.qml" << false; } -void tst_Drawer::hover() +void tst_QQuickDrawer::hover() { QFETCH(QString, source); QFETCH(bool, modal); @@ -556,7 +556,7 @@ void tst_Drawer::hover() QVERIFY(!drawerItem->isHovered()); } -void tst_Drawer::wheel_data() +void tst_QQuickDrawer::wheel_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("modal"); @@ -575,7 +575,7 @@ static bool sendWheelEvent(QQuickItem *item, const QPoint &localPos, int degrees return qGuiApp->notify(window, &wheelEvent); } -void tst_Drawer::wheel() +void tst_QQuickDrawer::wheel() { QFETCH(QString, source); QFETCH(bool, modal); @@ -640,7 +640,7 @@ void tst_Drawer::wheel() } } -void tst_Drawer::multiple() +void tst_QQuickDrawer::multiple() { QQuickApplicationHelper helper(this, QStringLiteral("multiple.qml")); QQuickWindow *window = helper.window; @@ -763,7 +763,7 @@ void tst_Drawer::multiple() QCOMPARE(leftDrawer->position(), 0.0); } -void tst_Drawer::touch_data() +void tst_QQuickDrawer::touch_data() { QTest::addColumn<QString>("source"); QTest::addColumn<QPoint>("from"); @@ -780,7 +780,7 @@ void tst_Drawer::touch_data() QTest::newRow("ApplicationWindow+Button:outside") << "applicationwindow-button.qml" << QPoint(300, 100) << QPoint(100, 100); } -void tst_Drawer::touch() +void tst_QQuickDrawer::touch() { QFETCH(QString, source); QFETCH(QPoint, from); @@ -818,7 +818,7 @@ void tst_Drawer::touch() QCOMPARE(drawer->position(), 0.0); } -void tst_Drawer::multiTouch() +void tst_QQuickDrawer::multiTouch() { QQuickApplicationHelper helper(this, QStringLiteral("multiTouch.qml")); QQuickWindow *window = helper.window; @@ -931,7 +931,7 @@ void tst_Drawer::multiTouch() QCOMPARE(overlayReleasedSpy.count(), 4); } -void tst_Drawer::grabber() +void tst_QQuickDrawer::grabber() { QQuickApplicationHelper helper(this, QStringLiteral("grabber.qml")); QQuickWindow *window = helper.window; @@ -967,14 +967,14 @@ void tst_Drawer::grabber() QTRY_COMPARE(popupClosedSpy.count(), 1); } -void tst_Drawer::interactive_data() +void tst_QQuickDrawer::interactive_data() { QTest::addColumn<QString>("source"); QTest::newRow("Window") << "window.qml"; QTest::newRow("ApplicationWindow") << "applicationwindow.qml"; } -void tst_Drawer::interactive() +void tst_QQuickDrawer::interactive() { QFETCH(QString, source); QQuickApplicationHelper helper(this, source); @@ -1021,7 +1021,7 @@ void tst_Drawer::interactive() QCOMPARE(aboutToHideSpy.count(), 0); } -void tst_Drawer::flickable_data() +void tst_QQuickDrawer::flickable_data() { QTest::addColumn<bool>("mouse"); QTest::addColumn<QPoint>("from"); @@ -1033,7 +1033,7 @@ void tst_Drawer::flickable_data() QTest::newRow("touch,diagonal") << false << QPoint(200, 200) << QPoint(250, 100); } -void tst_Drawer::flickable() +void tst_QQuickDrawer::flickable() { QFETCH(bool, mouse); QFETCH(QPoint, from); @@ -1083,7 +1083,7 @@ void tst_Drawer::flickable() QVERIFY(!flickable->isDragging()); } -void tst_Drawer::dragOverModalShadow_data() +void tst_QQuickDrawer::dragOverModalShadow_data() { QTest::addColumn<bool>("mouse"); QTest::newRow("mouse") << true; @@ -1091,7 +1091,7 @@ void tst_Drawer::dragOverModalShadow_data() } // QTBUG-60602 -void tst_Drawer::dragOverModalShadow() +void tst_QQuickDrawer::dragOverModalShadow() { QFETCH(bool, mouse); @@ -1139,7 +1139,7 @@ void tst_Drawer::dragOverModalShadow() QVERIFY(!drawer->isVisible()); } -void tst_Drawer::nonModal_data() +void tst_QQuickDrawer::nonModal_data() { QTest::addColumn<bool>("mouse"); QTest::newRow("mouse") << true; @@ -1147,7 +1147,7 @@ void tst_Drawer::nonModal_data() } // QTBUG-59652 -void tst_Drawer::nonModal() +void tst_QQuickDrawer::nonModal() { QFETCH(bool, mouse); @@ -1219,6 +1219,6 @@ void tst_Drawer::nonModal() QVERIFY(closedSpy.wait()); } -QTEST_MAIN(tst_Drawer) +QTEST_MAIN(tst_QQuickDrawer) -#include "tst_drawer.moc" +#include "tst_qquickdrawer.moc" diff --git a/tests/auto/menu/data/actions.qml b/tests/auto/qquickmenu/data/actions.qml index 0ec9f36c..0ec9f36c 100644 --- a/tests/auto/menu/data/actions.qml +++ b/tests/auto/qquickmenu/data/actions.qml diff --git a/tests/auto/menu/data/addItem.qml b/tests/auto/qquickmenu/data/addItem.qml index 0668e439..0668e439 100644 --- a/tests/auto/menu/data/addItem.qml +++ b/tests/auto/qquickmenu/data/addItem.qml diff --git a/tests/auto/menu/data/applicationwindow.qml b/tests/auto/qquickmenu/data/applicationwindow.qml index 265a2f1a..265a2f1a 100644 --- a/tests/auto/menu/data/applicationwindow.qml +++ b/tests/auto/qquickmenu/data/applicationwindow.qml diff --git a/tests/auto/menu/data/menuSeparator.qml b/tests/auto/qquickmenu/data/menuSeparator.qml index 6cdf8b27..6cdf8b27 100644 --- a/tests/auto/menu/data/menuSeparator.qml +++ b/tests/auto/qquickmenu/data/menuSeparator.qml diff --git a/tests/auto/menu/data/mnemonics.qml b/tests/auto/qquickmenu/data/mnemonics.qml index de4cd215..de4cd215 100644 --- a/tests/auto/menu/data/mnemonics.qml +++ b/tests/auto/qquickmenu/data/mnemonics.qml diff --git a/tests/auto/menu/data/order.qml b/tests/auto/qquickmenu/data/order.qml index db5c3c1a..db5c3c1a 100644 --- a/tests/auto/menu/data/order.qml +++ b/tests/auto/qquickmenu/data/order.qml diff --git a/tests/auto/menu/data/popup.qml b/tests/auto/qquickmenu/data/popup.qml index 6040e8ba..6040e8ba 100644 --- a/tests/auto/menu/data/popup.qml +++ b/tests/auto/qquickmenu/data/popup.qml diff --git a/tests/auto/menu/data/pressAndHold.qml b/tests/auto/qquickmenu/data/pressAndHold.qml index 6f0acd3a..6f0acd3a 100644 --- a/tests/auto/menu/data/pressAndHold.qml +++ b/tests/auto/qquickmenu/data/pressAndHold.qml diff --git a/tests/auto/menu/data/removeTakeItem.qml b/tests/auto/qquickmenu/data/removeTakeItem.qml index 89090fb6..89090fb6 100644 --- a/tests/auto/menu/data/removeTakeItem.qml +++ b/tests/auto/qquickmenu/data/removeTakeItem.qml diff --git a/tests/auto/menu/data/repeater.qml b/tests/auto/qquickmenu/data/repeater.qml index 2172f86a..2172f86a 100644 --- a/tests/auto/menu/data/repeater.qml +++ b/tests/auto/qquickmenu/data/repeater.qml diff --git a/tests/auto/menu/data/subMenus.qml b/tests/auto/qquickmenu/data/subMenus.qml index 49811bc2..49811bc2 100644 --- a/tests/auto/menu/data/subMenus.qml +++ b/tests/auto/qquickmenu/data/subMenus.qml diff --git a/tests/auto/menu/menu.pro b/tests/auto/qquickmenu/qquickmenu.pro index 9c9d9b48..ee539842 100644 --- a/tests/auto/menu/menu.pro +++ b/tests/auto/qquickmenu/qquickmenu.pro @@ -1,6 +1,6 @@ CONFIG += testcase -TARGET = tst_menu -SOURCES += tst_menu.cpp +TARGET = tst_qquickmenu +SOURCES += tst_qquickmenu.cpp macos:CONFIG -= app_bundle diff --git a/tests/auto/menu/tst_menu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp index 4497c096..1202072b 100644 --- a/tests/auto/menu/tst_menu.cpp +++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp @@ -56,7 +56,7 @@ using namespace QQuickVisualTestUtil; -class tst_menu : public QQmlDataTest +class tst_QQuickMenu : public QQmlDataTest { Q_OBJECT @@ -86,7 +86,7 @@ private slots: void addRemoveSubMenus(); }; -void tst_menu::defaults() +void tst_QQuickMenu::defaults() { QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml")); @@ -97,7 +97,7 @@ void tst_menu::defaults() QCOMPARE(emptyMenu->count(), 0); } -void tst_menu::count() +void tst_QQuickMenu::count() { QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml")); @@ -125,7 +125,7 @@ void tst_menu::count() QCOMPARE(countSpy.count(), 4); } -void tst_menu::mouse() +void tst_QQuickMenu::mouse() { if ((QGuiApplication::platformName() == QLatin1String("offscreen")) || (QGuiApplication::platformName() == QLatin1String("minimal"))) @@ -217,7 +217,7 @@ void tst_menu::mouse() // QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1)); } -void tst_menu::pressAndHold() +void tst_QQuickMenu::pressAndHold() { QQuickApplicationHelper helper(this, QLatin1String("pressAndHold.qml")); @@ -238,7 +238,7 @@ void tst_menu::pressAndHold() QTRY_VERIFY(!menu->isVisible()); } -void tst_menu::contextMenuKeyboard() +void tst_QQuickMenu::contextMenuKeyboard() { if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls) QSKIP("This platform only allows tab focus for text controls"); @@ -388,7 +388,7 @@ void tst_menu::contextMenuKeyboard() QVERIFY(!menu->isVisible()); } -void tst_menu::mnemonics() +void tst_QQuickMenu::mnemonics() { #ifdef Q_OS_MACOS QSKIP("Mnemonics are not used on macOS"); @@ -436,7 +436,7 @@ void tst_menu::mnemonics() QCOMPARE(subMenuItemSpy.count(), 1); } -void tst_menu::menuButton() +void tst_QQuickMenu::menuButton() { if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls) QSKIP("This platform only allows tab focus for text controls"); @@ -464,7 +464,7 @@ void tst_menu::menuButton() QVERIFY(firstItem->hasActiveFocus()); } -void tst_menu::addItem() +void tst_QQuickMenu::addItem() { QQuickApplicationHelper helper(this, QLatin1String("addItem.qml")); QQuickApplicationWindow *window = helper.appWindow; @@ -485,7 +485,7 @@ void tst_menu::addItem() QTRY_VERIFY(!menu->isVisible()); } -void tst_menu::menuSeparator() +void tst_QQuickMenu::menuSeparator() { QQuickApplicationHelper helper(this, QLatin1String("menuSeparator.qml")); QQuickWindow *window = helper.window; @@ -561,7 +561,7 @@ void tst_menu::menuSeparator() QCOMPARE(newMenuItem->focusReason(), Qt::BacktabFocusReason); } -void tst_menu::repeater() +void tst_QQuickMenu::repeater() { QQuickApplicationHelper helper(this, QLatin1String("repeater.qml")); QQuickWindow *window = helper.window; @@ -605,7 +605,7 @@ void tst_menu::repeater() } } -void tst_menu::order() +void tst_QQuickMenu::order() { QQuickApplicationHelper helper(this, QLatin1String("order.qml")); QQuickWindow *window = helper.window; @@ -626,7 +626,7 @@ void tst_menu::order() } } -void tst_menu::popup() +void tst_QQuickMenu::popup() { QQuickApplicationHelper helper(this, QLatin1String("popup.qml")); QQuickApplicationWindow *window = helper.appWindow; @@ -773,7 +773,7 @@ void tst_menu::popup() #endif } -void tst_menu::actions() +void tst_QQuickMenu::actions() { QQuickApplicationHelper helper(this, QLatin1String("actions.qml")); QQuickWindow *window = helper.window; @@ -841,7 +841,7 @@ void tst_menu::actions() QVERIFY(menuItem1.isNull()); } -void tst_menu::removeTakeItem() +void tst_QQuickMenu::removeTakeItem() { QQuickApplicationHelper helper(this, QLatin1String("removeTakeItem.qml")); QQuickWindow *window = helper.window; @@ -890,7 +890,7 @@ void tst_menu::removeTakeItem() QVERIFY(!menuItem3.isNull()); } -void tst_menu::subMenuMouse_data() +void tst_QQuickMenu::subMenuMouse_data() { QTest::addColumn<bool>("cascade"); @@ -898,7 +898,7 @@ void tst_menu::subMenuMouse_data() QTest::newRow("non-cascading") << false; } -void tst_menu::subMenuMouse() +void tst_QQuickMenu::subMenuMouse() { if ((QGuiApplication::platformName() == QLatin1String("offscreen")) || (QGuiApplication::platformName() == QLatin1String("minimal"))) @@ -993,7 +993,7 @@ void tst_menu::subMenuMouse() QVERIFY(!subSubMenu1->isVisible()); } -void tst_menu::subMenuKeyboard_data() +void tst_QQuickMenu::subMenuKeyboard_data() { QTest::addColumn<bool>("cascade"); QTest::addColumn<bool>("mirrored"); @@ -1004,7 +1004,7 @@ void tst_menu::subMenuKeyboard_data() QTest::newRow("non-cascading,mirrored") << false << true; } -void tst_menu::subMenuKeyboard() +void tst_QQuickMenu::subMenuKeyboard() { QFETCH(bool, cascade); QFETCH(bool, mirrored); @@ -1117,7 +1117,7 @@ void tst_menu::subMenuKeyboard() QVERIFY(!subSubMenu1->isVisible()); } -void tst_menu::subMenuPosition_data() +void tst_QQuickMenu::subMenuPosition_data() { QTest::addColumn<bool>("cascade"); QTest::addColumn<bool>("flip"); @@ -1135,7 +1135,7 @@ void tst_menu::subMenuPosition_data() QTest::newRow("non-cascading") << false << false << false << 0.0; } -void tst_menu::subMenuPosition() +void tst_QQuickMenu::subMenuPosition() { QFETCH(bool, cascade); QFETCH(bool, flip); @@ -1249,7 +1249,7 @@ void tst_menu::subMenuPosition() } } -void tst_menu::addRemoveSubMenus() +void tst_QQuickMenu::addRemoveSubMenus() { QQuickApplicationHelper helper(this, QLatin1String("subMenus.qml")); QQuickWindow *window = helper.window; @@ -1309,6 +1309,6 @@ void tst_menu::addRemoveSubMenus() QVERIFY(subSubMenu1Item.isNull()); } -QTEST_MAIN(tst_menu) +QTEST_MAIN(tst_QQuickMenu) -#include "tst_menu.moc" +#include "tst_qquickmenu.moc" diff --git a/tests/auto/popup/BLACKLIST b/tests/auto/qquickpopup/BLACKLIST index 47795a8b..47795a8b 100644 --- a/tests/auto/popup/BLACKLIST +++ b/tests/auto/qquickpopup/BLACKLIST diff --git a/tests/auto/popup/data/activeFocusOnClose1.qml b/tests/auto/qquickpopup/data/activeFocusOnClose1.qml index ee0295c1..ee0295c1 100644 --- a/tests/auto/popup/data/activeFocusOnClose1.qml +++ b/tests/auto/qquickpopup/data/activeFocusOnClose1.qml diff --git a/tests/auto/popup/data/activeFocusOnClose2.qml b/tests/auto/qquickpopup/data/activeFocusOnClose2.qml index cb215f9b..cb215f9b 100644 --- a/tests/auto/popup/data/activeFocusOnClose2.qml +++ b/tests/auto/qquickpopup/data/activeFocusOnClose2.qml diff --git a/tests/auto/popup/data/activeFocusOnClose3.qml b/tests/auto/qquickpopup/data/activeFocusOnClose3.qml index a8137b34..a8137b34 100644 --- a/tests/auto/popup/data/activeFocusOnClose3.qml +++ b/tests/auto/qquickpopup/data/activeFocusOnClose3.qml diff --git a/tests/auto/popup/data/applicationwindow-hover.qml b/tests/auto/qquickpopup/data/applicationwindow-hover.qml index 8cec6ba7..8cec6ba7 100644 --- a/tests/auto/popup/data/applicationwindow-hover.qml +++ b/tests/auto/qquickpopup/data/applicationwindow-hover.qml diff --git a/tests/auto/popup/data/applicationwindow-wheel.qml b/tests/auto/qquickpopup/data/applicationwindow-wheel.qml index a89bd0f6..a89bd0f6 100644 --- a/tests/auto/popup/data/applicationwindow-wheel.qml +++ b/tests/auto/qquickpopup/data/applicationwindow-wheel.qml diff --git a/tests/auto/popup/data/applicationwindow.qml b/tests/auto/qquickpopup/data/applicationwindow.qml index 659aa843..659aa843 100644 --- a/tests/auto/popup/data/applicationwindow.qml +++ b/tests/auto/qquickpopup/data/applicationwindow.qml diff --git a/tests/auto/popup/data/closeOnEscapeWithNestedPopups.qml b/tests/auto/qquickpopup/data/closeOnEscapeWithNestedPopups.qml index f41516c8..f41516c8 100644 --- a/tests/auto/popup/data/closeOnEscapeWithNestedPopups.qml +++ b/tests/auto/qquickpopup/data/closeOnEscapeWithNestedPopups.qml diff --git a/tests/auto/popup/data/cursor.qml b/tests/auto/qquickpopup/data/cursor.qml index fd4475a0..fd4475a0 100644 --- a/tests/auto/popup/data/cursor.qml +++ b/tests/auto/qquickpopup/data/cursor.qml diff --git a/tests/auto/popup/data/grabber.qml b/tests/auto/qquickpopup/data/grabber.qml index b9995b54..b9995b54 100644 --- a/tests/auto/popup/data/grabber.qml +++ b/tests/auto/qquickpopup/data/grabber.qml diff --git a/tests/auto/popup/data/nested.qml b/tests/auto/qquickpopup/data/nested.qml index 48e51fc8..48e51fc8 100644 --- a/tests/auto/popup/data/nested.qml +++ b/tests/auto/qquickpopup/data/nested.qml diff --git a/tests/auto/popup/data/orientation.qml b/tests/auto/qquickpopup/data/orientation.qml index cbf69b2b..cbf69b2b 100644 --- a/tests/auto/popup/data/orientation.qml +++ b/tests/auto/qquickpopup/data/orientation.qml diff --git a/tests/auto/popup/data/window-hover.qml b/tests/auto/qquickpopup/data/window-hover.qml index 669afb08..669afb08 100644 --- a/tests/auto/popup/data/window-hover.qml +++ b/tests/auto/qquickpopup/data/window-hover.qml diff --git a/tests/auto/popup/data/window-wheel.qml b/tests/auto/qquickpopup/data/window-wheel.qml index 45c09b45..45c09b45 100644 --- a/tests/auto/popup/data/window-wheel.qml +++ b/tests/auto/qquickpopup/data/window-wheel.qml diff --git a/tests/auto/popup/data/window.qml b/tests/auto/qquickpopup/data/window.qml index 962ab573..962ab573 100644 --- a/tests/auto/popup/data/window.qml +++ b/tests/auto/qquickpopup/data/window.qml diff --git a/tests/auto/popup/popup.pro b/tests/auto/qquickpopup/qquickpopup.pro index c863ba07..935e91bd 100644 --- a/tests/auto/popup/popup.pro +++ b/tests/auto/qquickpopup/qquickpopup.pro @@ -1,6 +1,6 @@ CONFIG += testcase -TARGET = tst_popup -SOURCES += tst_popup.cpp +TARGET = tst_qquickpopup +SOURCES += tst_qquickpopup.cpp macos:CONFIG -= app_bundle diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp index 184fe3c3..a1e5e246 100644 --- a/tests/auto/popup/tst_popup.cpp +++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp @@ -50,7 +50,7 @@ using namespace QQuickVisualTestUtil; -class tst_popup : public QQmlDataTest +class tst_QQuickPopup : public QQmlDataTest { Q_OBJECT @@ -84,20 +84,20 @@ private slots: void orientation(); }; -void tst_popup::initTestCase() +void tst_QQuickPopup::initTestCase() { QQmlDataTest::initTestCase(); qputenv("QML_NO_TOUCH_COMPRESSION", "1"); } -void tst_popup::visible_data() +void tst_QQuickPopup::visible_data() { QTest::addColumn<QString>("source"); QTest::newRow("Window") << "window.qml"; QTest::newRow("ApplicationWindow") << "applicationwindow.qml"; } -void tst_popup::visible() +void tst_QQuickPopup::visible() { QFETCH(QString, source); QQuickApplicationHelper helper(this, source); @@ -131,7 +131,7 @@ void tst_popup::visible() QVERIFY(!overlay->childItems().contains(popupItem)); } -void tst_popup::state() +void tst_QQuickPopup::state() { QQuickApplicationHelper helper(this, "applicationwindow.qml"); @@ -171,7 +171,7 @@ void tst_popup::state() QTRY_COMPARE(closedSpy.count(), 1); } -void tst_popup::overlay_data() +void tst_QQuickPopup::overlay_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("modal"); @@ -188,7 +188,7 @@ void tst_popup::overlay_data() QTest::newRow("ApplicationWindow,modal,dim") << "applicationwindow.qml" << true << true; } -void tst_popup::overlay() +void tst_QQuickPopup::overlay() { QFETCH(QString, source); QFETCH(bool, modal); @@ -345,14 +345,14 @@ void tst_popup::overlay() QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); } -void tst_popup::zOrder_data() +void tst_QQuickPopup::zOrder_data() { QTest::addColumn<QString>("source"); QTest::newRow("Window") << "window.qml"; QTest::newRow("ApplicationWindow") << "applicationwindow.qml"; } -void tst_popup::zOrder() +void tst_QQuickPopup::zOrder() { QFETCH(QString, source); QQuickApplicationHelper helper(this, source); @@ -386,7 +386,7 @@ void tst_popup::zOrder() QVERIFY(!popup->isVisible()); } -void tst_popup::windowChange() +void tst_QQuickPopup::windowChange() { QQuickPopup popup; QSignalSpy spy(&popup, SIGNAL(windowChanged(QQuickWindow*))); @@ -435,7 +435,7 @@ void tst_popup::windowChange() Q_DECLARE_METATYPE(QQuickPopup::ClosePolicy) -void tst_popup::closePolicy_data() +void tst_QQuickPopup::closePolicy_data() { qRegisterMetaType<QQuickPopup::ClosePolicy>(); @@ -459,7 +459,7 @@ void tst_popup::closePolicy_data() QTest::newRow("ApplicationWindow:CloseOnEscape") << "applicationwindow.qml"<< static_cast<QQuickPopup::ClosePolicy>(QQuickPopup::CloseOnEscape); } -void tst_popup::closePolicy() +void tst_QQuickPopup::closePolicy() { QFETCH(QString, source); QFETCH(QQuickPopup::ClosePolicy, closePolicy); @@ -538,7 +538,7 @@ void tst_popup::closePolicy() QVERIFY(popup->isVisible()); } -void tst_popup::activeFocusOnClose1() +void tst_QQuickPopup::activeFocusOnClose1() { // Test that a popup that never sets focus: true (e.g. ToolTip) doesn't affect // the active focus item when it closes. @@ -567,7 +567,7 @@ void tst_popup::activeFocusOnClose1() QVERIFY(focusedPopup->hasActiveFocus()); } -void tst_popup::activeFocusOnClose2() +void tst_QQuickPopup::activeFocusOnClose2() { // Test that a popup that sets focus: true but relinquishes focus (e.g. by // calling forceActiveFocus() on another item) before it closes doesn't @@ -602,7 +602,7 @@ void tst_popup::activeFocusOnClose2() QVERIFY(popup1->hasActiveFocus()); } -void tst_popup::activeFocusOnClose3() +void tst_QQuickPopup::activeFocusOnClose3() { // Test that a closing popup that had focus doesn't steal focus from // another popup that the focus was transferred to. @@ -634,7 +634,7 @@ void tst_popup::activeFocusOnClose3() QTRY_VERIFY(popup2->hasActiveFocus()); } -void tst_popup::hover_data() +void tst_QQuickPopup::hover_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("modal"); @@ -645,7 +645,7 @@ void tst_popup::hover_data() QTest::newRow("ApplicationWindow:modeless") << "applicationwindow-hover.qml" << false; } -void tst_popup::hover() +void tst_QQuickPopup::hover() { QFETCH(QString, source); QFETCH(bool, modal); @@ -698,7 +698,7 @@ void tst_popup::hover() QVERIFY(parentButton->isHovered()); } -void tst_popup::wheel_data() +void tst_QQuickPopup::wheel_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("modal"); @@ -717,7 +717,7 @@ static bool sendWheelEvent(QQuickItem *item, const QPoint &localPos, int degrees return qGuiApp->notify(window, &wheelEvent); } -void tst_popup::wheel() +void tst_QQuickPopup::wheel() { QFETCH(QString, source); QFETCH(bool, modal); @@ -782,7 +782,7 @@ void tst_popup::wheel() } } -void tst_popup::parentDestroyed() +void tst_QQuickPopup::parentDestroyed() { QQuickPopup popup; popup.setParentItem(new QQuickItem); @@ -790,7 +790,7 @@ void tst_popup::parentDestroyed() QVERIFY(!popup.parentItem()); } -void tst_popup::nested() +void tst_QQuickPopup::nested() { QQuickApplicationHelper helper(this, QStringLiteral("nested.qml")); QQuickWindow *window = helper.window; @@ -817,7 +817,7 @@ void tst_popup::nested() } // QTBUG-56697 -void tst_popup::grabber() +void tst_QQuickPopup::grabber() { QQuickApplicationHelper helper(this, QStringLiteral("grabber.qml")); QQuickWindow *window = helper.window; @@ -867,7 +867,7 @@ void tst_popup::grabber() QCOMPARE(combo->isVisible(), false); } -void tst_popup::cursorShape() +void tst_QQuickPopup::cursorShape() { // Ensure that the mouse cursor has the correct shape when over a popup // which is itself over an item with a different shape. @@ -901,10 +901,10 @@ void tst_popup::cursorShape() class FriendlyPopup : public QQuickPopup { - friend class tst_popup; + friend class tst_QQuickPopup; }; -void tst_popup::componentComplete() +void tst_QQuickPopup::componentComplete() { FriendlyPopup cppPopup; QVERIFY(cppPopup.isComponentComplete()); @@ -921,7 +921,7 @@ void tst_popup::componentComplete() QVERIFY(qmlPopup->isComponentComplete()); } -void tst_popup::closeOnEscapeWithNestedPopups() +void tst_QQuickPopup::closeOnEscapeWithNestedPopups() { // Tests the scenario in the Gallery example, where there are nested popups that should // close in the correct order when the Escape key is pressed. @@ -986,7 +986,7 @@ void tst_popup::closeOnEscapeWithNestedPopups() QCOMPARE(stackView->depth(), 1); } -void tst_popup::enabled() +void tst_QQuickPopup::enabled() { QQuickPopup popup; QVERIFY(popup.isEnabled()); @@ -1006,7 +1006,7 @@ void tst_popup::enabled() QCOMPARE(enabledSpy.count(), 2); } -void tst_popup::orientation_data() +void tst_QQuickPopup::orientation_data() { QTest::addColumn<Qt::ScreenOrientation>("orientation"); QTest::addColumn<QPointF>("position"); @@ -1017,7 +1017,7 @@ void tst_popup::orientation_data() QTest::newRow("InvertedLandscape") << Qt::InvertedLandscapeOrientation << QPointF(135, 330); } -void tst_popup::orientation() +void tst_QQuickPopup::orientation() { QFETCH(Qt::ScreenOrientation, orientation); QFETCH(QPointF, position); @@ -1036,6 +1036,6 @@ void tst_popup::orientation() QCOMPARE(popup->popupItem()->position(), position); } -QTEST_MAIN(tst_popup) +QTEST_MAIN(tst_QQuickPopup) -#include "tst_popup.moc" +#include "tst_qquickpopup.moc" diff --git a/tests/manual/styles-cover-flow/CoverFlowDelegate.qml b/tests/manual/styles-cover-flow/CoverFlowDelegate.qml new file mode 100644 index 00000000..8b220269 --- /dev/null +++ b/tests/manual/styles-cover-flow/CoverFlowDelegate.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtGraphicalEffects 1.0 +import QtQuick 2.10 + +Item { + id: root + width: PathView.view.delegateSize + height: width + z: PathView.zOrder + + transform: [ + Rotation { + angle: root.PathView.rotateY + origin.x: sourceImage.width / 2 + origin.y: sourceImage.height * 0.3 + axis.x: 0 + axis.y: 1 + axis.z: 0 + }, + Scale { + xScale: 1.0 + yScale: root.PathView.scale + origin.x: sourceImage.width / 2 + origin.y: sourceImage.height * 0.4 + } + ] + + Image { + id: sourceImage + width: root.PathView.view.delegateSize + height: width + fillMode: Image.PreserveAspectFit + source: "file:/" + docImagesDir + model.source + + Rectangle { + x: (sourceImage.width - sourceImage.paintedWidth) / 2 + width: sourceImage.paintedWidth + (index == 6 ? 2 : 1) + height: sourceImage.height + color: "transparent" + border.color: "#f4f4f4" + antialiasing: true + visible: !model.dark + } + } + + ShaderEffectSource { + id: reflection + sourceItem: sourceImage + y: sourceItem.height + width: sourceItem.width + height: sourceItem.height + + transform: [ + Rotation { + origin.x: reflection.width / 2 + origin.y: reflection.height / 2 + axis.x: 1 + axis.y: 0 + axis.z: 0 + angle: 180 + } + ] + } + + Rectangle { + objectName: sourceImage.source.toString().slice(-20) + x: (parent.width - sourceImage.paintedWidth) / 2// + (paintedWidthDiff > 0 ? 1.0 - paintedWidthDiff : 0) + y: reflection.y + width: sourceImage.paintedWidth + (index == 6 ? 2 : 1) + height: sourceImage.paintedHeight + + // TODO: figure out how to get perfect x/width without using the current width hack +// readonly property real paintedWidthDiff: sourceImage.paintedWidth - Math.floor(sourceImage.paintedWidth) + + gradient: Gradient { + GradientStop { + position: 0.0 + color: Qt.rgba(backgroundColor.r, backgroundColor.g, backgroundColor.b, 0.33) + } + GradientStop { + // This determines the point at which the reflection fades out. + position: 1.0 + color: backgroundColor + } + } + } +} diff --git a/tests/manual/styles-cover-flow/CoverFlowPath.qml b/tests/manual/styles-cover-flow/CoverFlowPath.qml new file mode 100644 index 00000000..f50cf31d --- /dev/null +++ b/tests/manual/styles-cover-flow/CoverFlowPath.qml @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.10 + +Path { + // Point 1 + property PathView pathView + + startX: 0 + startY: pathView.centerY + + PathAttribute { + name: "rotateY" + value: 50.0 + } + PathAttribute { + name: "scale" + value: 0.7 + } + PathAttribute { + name: "zOrder" + value: 1.0 + } + + // Line to point 2 + PathLine { + x: pathView.centerX - pathView.delegateSize * 0.4 + y: pathView.centerY + } + PathPercent { + value: 0.44 + } + PathAttribute { + name: "rotateY" + value: 50.0 + } + PathAttribute { + name: "scale" + value: 0.7 + } + PathAttribute { + name: "zOrder" + value: 10.0 + } + + // Quad to point 3 + PathQuad { + x: pathView.centerX + y: pathView.centerY + pathView.delegateSize * 0.04 + controlX: pathView.centerX - pathView.delegateSize * 0.2 + controlY: pathView.centerY + pathView.delegateSize * 0.04 + } + PathPercent { + value: 0.5 + } + PathAttribute { + name: "rotateY" + value: 0.0 + } + PathAttribute { + name: "scale" + value: 1.0 + } + PathAttribute { + name: "zOrder" + value: 50.0 + } + + // Quad to point 4 + PathQuad { + x: pathView.centerX + pathView.delegateSize * 0.4 + y: pathView.centerY + controlX: pathView.centerX + pathView.delegateSize * 0.2 + controlY: pathView.centerY + pathView.delegateSize * 0.04 + } + PathPercent { + value: 0.56 + } + PathAttribute { + name: "rotateY" + value: -50.0 + } + PathAttribute { + name: "scale" + value: 0.7 + } + PathAttribute { + name: "zOrder" + value: 10.0 + } + + // Line to point 5 + PathLine { + x: pathView.width + y: pathView.centerY + } + PathAttribute { + name: "rotateY" + value: -50.0 + } + PathAttribute { + name: "scale" + value: 0.7 + } + PathAttribute { + name: "zOrder" + value: 1.0 + } +} diff --git a/tests/manual/styles-cover-flow/styles-cover-flow.cpp b/tests/manual/styles-cover-flow/styles-cover-flow.cpp new file mode 100644 index 00000000..d665d613 --- /dev/null +++ b/tests/manual/styles-cover-flow/styles-cover-flow.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QQmlContext> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("docImagesDir", QString(DOC_IMAGES_DIR)); + engine.load(QUrl("qrc:/styles-cover-flow.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/tests/manual/styles-cover-flow/styles-cover-flow.pro b/tests/manual/styles-cover-flow/styles-cover-flow.pro new file mode 100644 index 00000000..2faa9fba --- /dev/null +++ b/tests/manual/styles-cover-flow/styles-cover-flow.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +TARGET = stylescoverflow +QT += quick quickcontrols2 + +SOURCES += \ + styles-cover-flow.cpp + +RESOURCES += \ + $$files(*.qml, true) + +DEFINES += DOC_IMAGES_DIR=\\\"$$PWD/../../../src/imports/controls/doc/images/\\\" diff --git a/tests/manual/styles-cover-flow/styles-cover-flow.qml b/tests/manual/styles-cover-flow/styles-cover-flow.qml new file mode 100644 index 00000000..3d8aea0f --- /dev/null +++ b/tests/manual/styles-cover-flow/styles-cover-flow.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.10 +import QtQuick.Window 2.3 + +Window { + // Different delegate positions and widths and window background colors + // can cause some unwanted "rogue pixels", so an easy way to get it perfect + // is to mess with the width. + width: 814 + height: 512 + visible: true + color: backgroundColor + flags: Qt.FramelessWindowHint + + readonly property color backgroundColor: "#ffffff" + + Shortcut { + sequence: "Ctrl+Q" + onActivated: Qt.quit() + } + + PathView { + id: view + anchors.fill: parent + anchors.leftMargin: 130 + anchors.rightMargin: 130 + model: ListModel { + ListElement { source: "qtquickcontrols2-default.png"; dark: false } + ListElement { source: "qtquickcontrols2-fusion.png"; dark: false } + ListElement { source: "qtquickcontrols2-universal-light.png"; dark: false } + ListElement { source: "qtquickcontrols2-universal-dark.png"; dark: true } + ListElement { source: "qtquickcontrols2-material-dark.png"; dark: true } + ListElement { source: "qtquickcontrols2-imagine.png"; dark: false } + ListElement { source: "qtquickcontrols2-material-light.png"; dark: false } + } + + highlightRangeMode: PathView.StrictlyEnforceRange + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + pathItemCount: 9 + + property real centerX: width / 2 + property real centerY: height * 0.4 + property real delegateSize: 393 / 2 + + path: CoverFlowPath { + pathView: view + } + delegate: CoverFlowDelegate {} + } +} diff --git a/tests/manual/testbench/assetfixer.cpp b/tests/manual/testbench/assetfixer.cpp index 21a67573..1f914e71 100644 --- a/tests/manual/testbench/assetfixer.cpp +++ b/tests/manual/testbench/assetfixer.cpp @@ -515,6 +515,7 @@ void AssetFixer::clearImageCache() // We can't seem to disable image caching on a per-Image basis (by the time the QQuickImages // are available, the cache has already been filled), so we call this instead. + qCDebug(lcAssetFixer) << "Calling QQuickWindow::releaseResources() to clear pixmap cache"; window->releaseResources(); } diff --git a/tests/manual/testbench/controls/CheckDelegate.qml b/tests/manual/testbench/controls/CheckDelegate.qml index fc6ce6eb..b742b170 100644 --- a/tests/manual/testbench/controls/CheckDelegate.qml +++ b/tests/manual/testbench/controls/CheckDelegate.qml @@ -70,6 +70,7 @@ QtObject { checkState: is("checked") ? Qt.Checked : is("partially-checked") ? Qt.PartiallyChecked : Qt.Unchecked // Only set it if it's pressed, or the non-pressed examples will have no press effects down: is("pressed") ? true : undefined + focusPolicy: Qt.StrongFocus } property Component exampleComponent: ListView { @@ -80,6 +81,7 @@ QtObject { delegate: CheckDelegate { width: parent.width text: "CheckDelegate" + focusPolicy: Qt.StrongFocus } } } diff --git a/tests/manual/testbench/controls/Dialog.qml b/tests/manual/testbench/controls/Dialog.qml index b05ef1e3..c550cdae 100644 --- a/tests/manual/testbench/controls/Dialog.qml +++ b/tests/manual/testbench/controls/Dialog.qml @@ -57,7 +57,9 @@ QtObject { property string customControlName: qsTr("Dialog") property var supportedStates: [ - [] + [], + ["modal"], + ["dim"] ] property Component component: Button { @@ -73,6 +75,8 @@ QtObject { y: (window.height - height) / 2 standardButtons: Dialog.Ok | Dialog.Cancel parent: window.contentItem + modal: is("modal") + dim: is("dim") Label { text: "Lorem ipsum dolor sit amet, \nconsectetuer adipiscing elit, \n" diff --git a/tests/manual/testbench/controls/ItemDelegate.qml b/tests/manual/testbench/controls/ItemDelegate.qml index 98f13556..44882df9 100644 --- a/tests/manual/testbench/controls/ItemDelegate.qml +++ b/tests/manual/testbench/controls/ItemDelegate.qml @@ -67,6 +67,7 @@ QtObject { // Only set it if it's pressed, or the non-pressed examples will have no press effects down: is("pressed") ? true : undefined highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus } property Component exampleComponent: ListView { @@ -77,6 +78,7 @@ QtObject { delegate: ItemDelegate { width: parent.width text: "ItemDelegate" + focusPolicy: Qt.StrongFocus } } } diff --git a/tests/manual/testbench/controls/MenuBar.qml b/tests/manual/testbench/controls/MenuBar.qml new file mode 100644 index 00000000..00db9af1 --- /dev/null +++ b/tests/manual/testbench/controls/MenuBar.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +// TODO +QtObject { + property string customControlName: qsTr("MenuBar & MenuBarItem") + + property var supportedStates: [ + [] + ] + + property Component component: MenuBar { + MenuBarItem { + text: qsTr("Normal") + } + MenuBarItem { + text: qsTr("Pressed") + down: true + } + MenuBarItem { + text: qsTr("Highlighted") + highlighted: true + } + MenuBarItem { + text: qsTr("Disabled") + enabled: false + } + } +} diff --git a/tests/manual/testbench/controls/RadioDelegate.qml b/tests/manual/testbench/controls/RadioDelegate.qml index cb1f6139..fcae84f7 100644 --- a/tests/manual/testbench/controls/RadioDelegate.qml +++ b/tests/manual/testbench/controls/RadioDelegate.qml @@ -68,6 +68,7 @@ QtObject { checked: is("checked") // Only set it if it's pressed, or the non-pressed examples will have no press effects down: is("pressed") ? true : undefined + focusPolicy: Qt.StrongFocus } } @@ -79,6 +80,7 @@ QtObject { delegate: RadioDelegate { width: parent.width text: "RadioDelegate" + focusPolicy: Qt.StrongFocus } } } diff --git a/tests/manual/testbench/controls/ScrollBar.qml b/tests/manual/testbench/controls/ScrollBar.qml index abe1d007..f59796d2 100644 --- a/tests/manual/testbench/controls/ScrollBar.qml +++ b/tests/manual/testbench/controls/ScrollBar.qml @@ -96,7 +96,7 @@ QtObject { ScrollBar { id: horizontalScrollBar enabled: !is("disabled") - orientation: Qt.Vertical + orientation: Qt.Horizontal interactive: is("interactive") visible: is("horizontal") size: 0.3 diff --git a/tests/manual/testbench/controls/ScrollIndicator.qml b/tests/manual/testbench/controls/ScrollIndicator.qml index 8c5079fa..32c66aad 100644 --- a/tests/manual/testbench/controls/ScrollIndicator.qml +++ b/tests/manual/testbench/controls/ScrollIndicator.qml @@ -86,7 +86,7 @@ QtObject { ScrollIndicator { id: horizontalScrollIndicator enabled: !is("disabled") - orientation: Qt.Vertical + orientation: Qt.Horizontal active: true visible: is("horizontal") size: 0.3 diff --git a/tests/manual/testbench/controls/SpinBox.qml b/tests/manual/testbench/controls/SpinBox.qml index 87e5cfae..77094dc0 100644 --- a/tests/manual/testbench/controls/SpinBox.qml +++ b/tests/manual/testbench/controls/SpinBox.qml @@ -53,16 +53,18 @@ import QtQuick.Controls 2.3 QtObject { property var supportedStates: [ - ["disabled"], + [], ["pressed"], + ["disabled"], ["mirrored"], - ["mirrored", "disabled"], ["mirrored", "pressed"], + ["mirrored", "disabled"], ["editable"], ["editable", "pressed"], + ["editable", "disabled"], ["editable", "mirrored"], ["editable", "mirrored", "pressed"], - ["editable", "mirrored", "mirrored"] + ["editable", "mirrored", "disabled"] ] property Component component: SpinBox { diff --git a/tests/manual/testbench/controls/SwipeDelegate.qml b/tests/manual/testbench/controls/SwipeDelegate.qml index 3ea67101..6143a50f 100644 --- a/tests/manual/testbench/controls/SwipeDelegate.qml +++ b/tests/manual/testbench/controls/SwipeDelegate.qml @@ -83,6 +83,7 @@ QtObject { // Only set it if it's pressed, or the non-pressed examples will have no press effects down: is("pressed") ? true : undefined highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus swipe.left: actionComponent swipe.right: actionComponent @@ -96,6 +97,7 @@ QtObject { delegate: SwipeDelegate { width: parent.width text: "SwipeDelegate" + focusPolicy: Qt.StrongFocus swipe.left: actionComponent swipe.right: actionComponent diff --git a/tests/manual/testbench/controls/Switch.qml b/tests/manual/testbench/controls/Switch.qml index 70f44abd..63051a50 100644 --- a/tests/manual/testbench/controls/Switch.qml +++ b/tests/manual/testbench/controls/Switch.qml @@ -65,7 +65,7 @@ QtObject { ] property Component component: Switch { - text: "CheckBox" + text: "Switch" enabled: !is("disabled") checked: is("checked") // Only set it if it's pressed, or the non-pressed examples will have no press effects diff --git a/tests/manual/testbench/controls/SwitchDelegate.qml b/tests/manual/testbench/controls/SwitchDelegate.qml index aad2eed3..4cb42105 100644 --- a/tests/manual/testbench/controls/SwitchDelegate.qml +++ b/tests/manual/testbench/controls/SwitchDelegate.qml @@ -67,6 +67,7 @@ QtObject { // Only set it if it's pressed, or the non-pressed examples will have no press effects down: is("pressed") ? true : undefined highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus LayoutMirroring.enabled: is("mirrored") } @@ -79,6 +80,7 @@ QtObject { delegate: SwitchDelegate { width: parent.width text: "SwitchDelegate" + focusPolicy: Qt.StrongFocus } } } diff --git a/tests/manual/testbench/controls/TextArea.qml b/tests/manual/testbench/controls/TextArea.qml index de34076a..8f2493f4 100644 --- a/tests/manual/testbench/controls/TextArea.qml +++ b/tests/manual/testbench/controls/TextArea.qml @@ -57,7 +57,17 @@ QtObject { ["disabled"], ] - property Component component: TextArea { - text: "TextArea\nTextArea\nTextArea" + property Component component: Column { + spacing: 10 + + TextArea { + text: "TextArea\nwith\ntext" + enabled: !is("disabled") + } + + TextArea { + placeholderText: "TextArea with placeholderText" + enabled: !is("disabled") + } } } diff --git a/tests/manual/testbench/controls/TextField.qml b/tests/manual/testbench/controls/TextField.qml index 6986854b..7ecd21b2 100644 --- a/tests/manual/testbench/controls/TextField.qml +++ b/tests/manual/testbench/controls/TextField.qml @@ -57,8 +57,17 @@ QtObject { ["disabled"], ] - property Component component: TextField { - text: "TextField" - enabled: !is("disabled") + property Component component: Column { + spacing: 10 + + TextField { + text: "TextField with text" + enabled: !is("disabled") + } + + TextField { + placeholderText: "TextField with placeholderText" + enabled: !is("disabled") + } } } diff --git a/tests/manual/testbench/qml.qrc b/tests/manual/testbench/qml.qrc index 85d7f5d3..a0927f35 100644 --- a/tests/manual/testbench/qml.qrc +++ b/tests/manual/testbench/qml.qrc @@ -39,5 +39,6 @@ <file>controls/Tumbler.qml</file> <file>controls/BusyIndicator.qml</file> <file>testbench.qml</file> + <file>controls/MenuBar.qml</file> </qresource> </RCC> diff --git a/tests/manual/testbench/testbench.qml b/tests/manual/testbench/testbench.qml index 43f4465e..d9bf0fe5 100644 --- a/tests/manual/testbench/testbench.qml +++ b/tests/manual/testbench/testbench.qml @@ -53,7 +53,7 @@ import QtQuick.Window 2.3 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.3 import QtQuick.Controls.Imagine 2.3 -import Qt.labs.folderlistmodel 1.0 +import Qt.labs.folderlistmodel 2.2 import Qt.labs.settings 1.0 import App 1.0 @@ -266,6 +266,10 @@ ApplicationWindow { function reloadAssets() { console.log(brief, "Reloading assets...") + // Clear the model, otherwise ListView will keep the old items around + // with the old assets, even after clearing the pixmap cache + listView.resettingModel = true + listView.model = null window.Imagine.path = "" assetReloadNextFrameTimer.start() } @@ -297,9 +301,14 @@ ApplicationWindow { window.Imagine.path = Qt.binding(function() { return settings.useCustomImaginePath && settings.imaginePath.length > 0 ? settings.imaginePath : undefined }) + infoToolTip.text = "Reloaded assets" infoToolTip.timeout = 1500 infoToolTip.open() + + listView.model = controlFolderListModel + listView.resettingModel = false + console.log(brief, "... reloaded assets.") } } @@ -378,18 +387,30 @@ ApplicationWindow { return paletteSettings.useCustomPalette && paletteColorString.length > 0 ? paletteColorString : undefined } + FolderListModel { + id: controlFolderListModel + folder: "qrc:/controls" + showDirs: false + nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : [] + caseSensitive: false + } + ListView { + id: listView anchors.fill: parent spacing: 30 - visible: !busyIndicatorRow.visible + visible: !busyIndicatorRow.visible && !resettingModel - ScrollBar.vertical: ScrollBar {} + property bool resettingModel: false - model: FolderListModel { - folder: "qrc:/controls" - showDirs: false - nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : [] + ScrollBar.vertical: ScrollBar { + parent: contentPane + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom } + + model: controlFolderListModel delegate: ColumnLayout { id: rootDelegate width: parent.width |