Hello community, here is the log from the commit of package qqc2-desktop-style for openSUSE:Factory checked in at 2018-12-21 08:21:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qqc2-desktop-style (Old) and /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qqc2-desktop-style" Fri Dec 21 08:21:24 2018 rev:16 rq:658606 version:5.53.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qqc2-desktop-style/qqc2-desktop-style.changes 2018-11-15 12:39:37.578305447 +0100 +++ /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.28833/qqc2-desktop-style.changes 2018-12-21 08:21:35.557560255 +0100 @@ -1,0 +2,23 @@ +Sun Dec 09 19:43:46 UTC 2018 - [email protected] + +- Update to 5.53.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.53.0.php +- Changes since 5.52.0: + * consistent sizing of item compared to QWidgets + * emit activated + * same behavior as qwidgets comboboxes + * fix Menu sizing + * default values for ToolTip + * proper line widths + * make sure flickables are pixelAligned + * Fix compilation + * Support for QGuiApplication-based apps (kde#396287) + * touchscreen text controls + * Size according to specified icon width and height + * Honor flat property of buttons + * Remove qt include prefix + * Fix issue where there's only one element on the menu + +------------------------------------------------------------------- Old: ---- qqc2-desktop-style-5.52.0.tar.xz New: ---- qqc2-desktop-style-5.53.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qqc2-desktop-style.spec ++++++ --- /var/tmp/diff_new_pack.rTIF13/_old 2018-12-21 08:21:36.129559720 +0100 +++ /var/tmp/diff_new_pack.rTIF13/_new 2018-12-21 08:21:36.129559720 +0100 @@ -16,9 +16,9 @@ # -%define _tar_path 5.52 +%define _tar_path 5.53 Name: qqc2-desktop-style -Version: 5.52.0 +Version: 5.53.0 Release: 0 Summary: A Qt Quick Controls 2 Style for Desktop UIs License: GPL-2.0-or-later ++++++ qqc2-desktop-style-5.52.0.tar.xz -> qqc2-desktop-style-5.53.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/CMakeLists.txt new/qqc2-desktop-style-5.53.0/CMakeLists.txt --- old/qqc2-desktop-style-5.52.0/CMakeLists.txt 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/CMakeLists.txt 2018-12-01 15:42:55.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.52.0") # handled by release scripts -set(KF5_DEP_VERSION "5.52.0") # handled by release scripts +set(KF5_VERSION "5.53.0") # handled by release scripts +set(KF5_DEP_VERSION "5.53.0") # handled by release scripts project(qqc2-desktop-style VERSION ${KF5_VERSION}) -set(REQUIRED_QT_VERSION 5.8.0) +set(REQUIRED_QT_VERSION 5.9.0) ################# Disallow in-source build ################# @@ -21,7 +21,7 @@ ################# set KDE specific information ################# -find_package(ECM 5.52.0 REQUIRED NO_MODULE) +find_package(ECM 5.53.0 REQUIRED NO_MODULE) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/Button.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/Button.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/Button.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/Button.qml 2018-12-01 15:42:55.000000000 +0100 @@ -59,7 +59,10 @@ activeControl: controlRoot.isDefault ? "default" : "f" properties: { "icon": controlRoot.icon ? (controlRoot.icon.name || controlRoot.icon.source) : "", - "iconColor": controlRoot.icon && controlRoot.icon.color.a > 0? controlRoot.icon.color : Kirigami.Theme.textColor + "iconColor": controlRoot.icon && controlRoot.icon.color.a > 0? controlRoot.icon.color : Kirigami.Theme.textColor, + "iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0, + "iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0, + "flat": controlRoot.flat } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/ComboBox.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/ComboBox.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/ComboBox.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/ComboBox.qml 2018-12-01 15:42:55.000000000 +0100 @@ -28,6 +28,8 @@ import QtGraphicalEffects 1.0 import org.kde.kirigami 2.4 as Kirigami +import "private" as Private + T.ComboBox { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette @@ -47,7 +49,7 @@ delegate: ItemDelegate { width: controlRoot.popup.width text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData - highlighted: controlRoot.highlightedIndex == index + highlighted: mouseArea.pressed ? listView.currentIndex == index : controlRoot.highlightedIndex == index property bool separatorVisible: false Kirigami.Theme.colorSet: controlRoot.Kirigami.Theme.inherit ? controlRoot.Kirigami.Theme.colorSet : Kirigami.Theme.View Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit @@ -55,33 +57,121 @@ indicator: Item {} - contentItem: T.TextField { - padding: 0 + contentItem: MouseArea { + id: mouseArea + anchors.fill: parent + acceptedButtons: Qt.LeftButton + preventStealing: true + property int indexUnderMouse: -1 + onWheel: { + if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { + controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, delegateModel.count -1); + } else { + controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); + } + controlRoot.activated(controlRoot.currentIndex); + } + onPressed: { + indexUnderMouse = -1; + listView.currentIndex = controlRoot.highlightedIndex + controlRoot.down = true; + controlRoot.pressed = true; + controlRoot.popup.visible = !controlRoot.popup.visible; + } + onReleased: { + if (!containsMouse) { + controlRoot.down = false; + controlRoot.pressed = false; + controlRoot.popup.visible = false; + } + if (indexUnderMouse > -1) { + controlRoot.currentIndex = indexUnderMouse; + controlRoot.activated(indexUnderMouse); + } + } + onCanceled: { + controlRoot.down = false; + controlRoot.pressed = false; + } + onPositionChanged: { + var pos = listView.mapFromItem(this, mouse.x, mouse.y); + indexUnderMouse = listView.indexAt(pos.x, pos.y); + listView.currentIndex = indexUnderMouse; + } + + Connections { + target: popup + onClosed: { + controlRoot.down = false; + controlRoot.pressed = false; + } + } + T.TextField { + id: textField + padding: 0 + anchors { + fill:parent + leftMargin: controlRoot.leftPadding + rightMargin: controlRoot.rightPadding + topMargin: controlRoot.topPadding + bottomMargin: controlRoot.bottomPadding + } + text: controlRoot.editable ? controlRoot.editText : controlRoot.displayText + + enabled: controlRoot.editable + autoScroll: controlRoot.editable + readOnly: controlRoot.down + + visible: typeof(controlRoot.editable) != "undefined" && controlRoot.editable + inputMethodHints: controlRoot.inputMethodHints + validator: controlRoot.validator + + // Work around Qt bug where NativeRendering breaks for non-integer scale factors + // https://bugreports.qt.io/browse/QTBUG-67007 + renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering + color: controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor + selectionColor: Kirigami.Theme.highlightColor + selectedTextColor: Kirigami.Theme.highlightedTextColor + + selectByMouse: !Kirigami.Settings.tabletMode + cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined + + font: controlRoot.font + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + opacity: controlRoot.enabled ? 1 : 0.3 + + onFocusChanged: { + if (focus) { + Private.MobileTextActionsToolBar.controlRoot = textField; + } + } - text: controlRoot.editable ? controlRoot.editText : controlRoot.displayText + onPressAndHold: { + if (!Kirigami.Settings.tabletMode) { + return; + } + forceActiveFocus(); + cursorPosition = positionAt(event.x, event.y); + selectWord(); + } + } + } - enabled: controlRoot.editable - autoScroll: controlRoot.editable - readOnly: controlRoot.down - - visible: typeof(controlRoot.editable) != "undefined" && controlRoot.editable - inputMethodHints: controlRoot.inputMethodHints - validator: controlRoot.validator - - // Work around Qt bug where NativeRendering breaks for non-integer scale factors - // https://bugreports.qt.io/browse/QTBUG-67007 - renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering - color: controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor - selectionColor: Kirigami.Theme.highlightColor - selectedTextColor: Kirigami.Theme.highlightedTextColor - selectByMouse: true - - font: controlRoot.font - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - opacity: controlRoot.enabled ? 1 : 0.3 + Component { + id: mobileCursor + Private.MobileCursor { + target: textField + } } + Private.MobileCursor { + target: textField + selectionStartHandle: true + property var rect: target.positionToRectangle(target.selectionStart) + x: rect.x + 5 + y: rect.y + 6 + } background: StylePrivate.StyleItem { id: styleitem @@ -99,23 +189,6 @@ properties: { "editable" : control.editable } - - MouseArea { - anchors { - fill: parent - leftMargin: controlRoot.leftPadding - rightMargin: controlRoot.rightPadding - } - acceptedButtons: Qt.NoButton - onWheel: { - if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { - controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, delegateModel.count -1); - } else { - controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); - } - controlRoot.activated(controlRoot.currentIndex); - } - } } popup: T.Popup { @@ -128,7 +201,7 @@ Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit contentItem: ListView { - id: listview + id: listView clip: true implicitHeight: contentHeight model: controlRoot.popup.visible ? controlRoot.delegateModel : null diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/Menu.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/Menu.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/Menu.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/Menu.qml 2018-12-01 15:42:55.000000000 +0100 @@ -30,7 +30,7 @@ T.Menu { id: control - @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette +@DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, @@ -38,15 +38,21 @@ margins: 0 -@DISABLE_UNDER_QQC2_2_3@ delegate: MenuItem { } +@DISABLE_UNDER_QQC2_2_3@ delegate: MenuItem { width: parent.width; onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() } contentItem: ListView { - implicitWidth: control.contentItem.childrenRect.width implicitHeight: contentHeight property bool hasCheckables: false property bool hasIcons: false model: control.contentModel + implicitWidth: { + var maxWidth = 0; + for (var i = 0; i < contentItem.children.length; ++i) { + maxWidth = Math.max(maxWidth, contentItem.children[i].implicitWidth); + } + return maxWidth; + } interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false clip: true currentIndex: control.currentIndex || 0 @@ -94,7 +100,6 @@ background: Rectangle { radius: 2 implicitWidth: Kirigami.Units.gridUnit * 8 - implicitHeight: 40 color: Kirigami.Theme.backgroundColor property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/MenuItem.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/MenuItem.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/MenuItem.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/MenuItem.qml 2018-12-01 15:42:55.000000000 +0100 @@ -30,7 +30,7 @@ @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.implicitWidth + leftPadding + rightPadding) + contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0)) implicitHeight: visible ? Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) : 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/ScrollView.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/ScrollView.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/ScrollView.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/ScrollView.qml 2018-12-01 15:42:55.000000000 +0100 @@ -72,6 +72,7 @@ //don't make the scrolling items overlap the background borders. flickableItem.anchors.margins = Qt.binding(function() { return controlRoot.background && controlRoot.background.visible ? 2 : 0; }); flickableItem.clip = true; + flickableItem.pixelAligned = true; flickableItem.interactive = Kirigami.Settings.isMobile } onPressed: { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/SpinBox.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/SpinBox.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/SpinBox.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/SpinBox.qml 2018-12-01 15:42:55.000000000 +0100 @@ -32,7 +32,7 @@ Kirigami.Theme.inherit: false implicitWidth: Math.max(48, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth) - implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding + implicitHeight: Math.max(background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) padding: 6 leftPadding: padding + (controlRoot.mirrored ? (up.indicator ? up.indicator.width : 0) : 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/TextArea.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/TextArea.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/TextArea.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/TextArea.qml 2018-12-01 15:42:55.000000000 +0100 @@ -25,6 +25,7 @@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import "private" as Private T.TextArea { id: controlRoot @@ -45,12 +46,45 @@ selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor wrapMode: Text.WordWrap + hoverEnabled: !Kirigami.Settings.tabletMode verticalAlignment: TextEdit.AlignTop // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering - selectByMouse: true + + selectByMouse: !Kirigami.Settings.tabletMode + + cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined + Component { + id: mobileCursor + Private.MobileCursor { + target: controlRoot + } + } + + onPressAndHold: { + if (!Kirigami.Settings.tabletMode) { + return; + } + forceActiveFocus(); + cursorPosition = positionAt(event.x, event.y); + selectWord(); + } + + Private.MobileCursor { + target: controlRoot + selectionStartHandle: true + property var rect: target.positionToRectangle(target.selectionStart) + x: rect.x + y: rect.y + } + + onFocusChanged: { + if (focus) { + Private.MobileTextActionsToolBar.controlRoot = controlRoot; + } + } Label { id: placeholder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/TextField.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/TextField.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/TextField.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/TextField.qml 2018-12-01 15:42:55.000000000 +0100 @@ -26,6 +26,7 @@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate +import "private" as Private T.TextField { id: controlRoot @@ -37,7 +38,7 @@ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) || contentWidth + leftPadding + rightPadding implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, - background ? 22 : 0, + background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) padding: 6 @@ -46,11 +47,41 @@ selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor verticalAlignment: TextInput.AlignVCenter + hoverEnabled: !Kirigami.Settings.tabletMode // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering - selectByMouse: true + selectByMouse: !Kirigami.Settings.tabletMode + + cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined + Component { + id: mobileCursor + Private.MobileCursor { + target: controlRoot + } + } + onFocusChanged: { + if (focus) { + Private.MobileTextActionsToolBar.controlRoot = controlRoot; + } + } + + onPressAndHold: { + if (!Kirigami.Settings.tabletMode) { + return; + } + forceActiveFocus(); + cursorPosition = positionAt(event.x, event.y); + selectWord(); + } + Private.MobileCursor { + target: controlRoot + selectionStartHandle: true + property var rect: controlRoot.positionToRectangle(controlRoot.selectionStart) + x: rect.x + target.padding + y: rect.y + target.padding + } Controls.Label { id: placeholder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/ToolTip.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/ToolTip.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/ToolTip.qml 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/ToolTip.qml 2018-12-01 15:42:55.000000000 +0100 @@ -42,6 +42,10 @@ margins: 6 padding: 6 + visible: Kirigami.Settings.tabletMode ? parent.pressed : parent.hovered + delay: Kirigami.Settings.tabletMode ? Qt.styleHints.mousePressAndHoldInterval : 1000 + timeout: 5000 + closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent contentItem: Controls.Label { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/MobileCursor.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/MobileCursor.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/MobileCursor.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/MobileCursor.qml 2018-12-01 15:42:55.000000000 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2018 by Marco Martin <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.1 +import org.kde.kirigami 2.5 as Kirigami + +Item { + id: root + width: 1 //<-important that this is actually a single device pixel + height: Kirigami.Units.gridUnit + + property Item target + + property bool selectionStartHandle: false + + visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0) + + Rectangle { + width: Math.round(Kirigami.Units.devicePixelRatio * 3) + anchors { + horizontalCenter: parent.horizontalCenter + top: parent.top + bottom: parent.bottom + } + color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) + radius: width + Rectangle { + width: Math.round(Kirigami.Units.gridUnit/1.5) + height: width + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.bottom + } + radius: width + color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) + } + MouseArea { + anchors { + fill: parent + margins: -Kirigami.Units.gridUnit + } + preventStealing: true + onPositionChanged: { + var pos = mapToItem(target, mouse.x, mouse.y); + pos = target.positionAt(pos.x, pos.y); + + if (target.selectedText.length > 0) { + if (selectionStartHandle) { + target.select(Math.min(pos, target.selectionEnd - 1), target.selectionEnd); + } else { + target.select(target.selectionStart, Math.max(pos, target.selectionStart + 1)); + } + } else { + target.cursorPosition = pos; + } + } + } + } +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/MobileTextActionsToolBar.qml new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/MobileTextActionsToolBar.qml --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/MobileTextActionsToolBar.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/MobileTextActionsToolBar.qml 2018-12-01 15:42:55.000000000 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2018 by Marco Martin <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +pragma Singleton + +import QtQuick 2.1 +import QtQuick.Layouts 1.2 +import QtQuick.Window 2.2 +import QtQuick.Controls @QQC2_VERSION@ +import org.kde.kirigami 2.5 as Kirigami + +Popup { + id: root + + property Item controlRoot + parent: controlRoot ? controlRoot.Window.contentItem : undefined + modal: false + focus: false + closePolicy: Popup.NoAutoClose + + x: controlRoot ? Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width/2), controlRoot.Window.contentItem.width - root.width) : 0 + + y: { + if (!controlRoot) { + return false; + } + var desiredY = controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionStart).y).y - root.height; + + if (desiredY >= 0) { + return Math.min(desiredY, controlRoot.Window.contentItem.height - root.height); + } else { + return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(Kirigami.Units.gridUnit*1.5)).y), controlRoot.Window.contentItem.height - root.height); + } + } + + + visible: controlRoot ? Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false + + width: contentItem.implicitWidth + leftPadding + rightPadding + + contentItem: RowLayout { + ToolButton { + focusPolicy: Qt.NoFocus + icon.name: "edit-cut" + visible: controlRoot.selectedText.length > 0 + onClicked: { + controlRoot.cut(); + } + } + ToolButton { + focusPolicy: Qt.NoFocus + icon.name: "edit-copy" + visible: controlRoot.selectedText.length > 0 + onClicked: { + controlRoot.copy(); + } + } + ToolButton { + focusPolicy: Qt.NoFocus + icon.name: "edit-paste" + onClicked: { + controlRoot.paste(); + } + } + } +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/qmldir new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/qmldir --- old/qqc2-desktop-style-5.52.0/org.kde.desktop/private/qmldir 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/org.kde.desktop/private/qmldir 2018-12-01 15:42:55.000000000 +0100 @@ -0,0 +1,5 @@ + +singleton MobileTextActionsToolBar 1.0 MobileTextActionsToolBar.qml +DefaultListItemBackground 1.0 DefaultListItemBackground.qml +MobileCursor 1.0 MobileCursor.qml +FocusRect 1.0 FocusRect.qml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/plugin/kquickpadding_p.h new/qqc2-desktop-style-5.53.0/plugin/kquickpadding_p.h --- old/qqc2-desktop-style-5.52.0/plugin/kquickpadding_p.h 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/plugin/kquickpadding_p.h 2018-12-01 15:42:55.000000000 +0100 @@ -42,7 +42,7 @@ #ifndef KQUICKPADDING_H #define KQUICKPADDING_H -#include <QtCore/qobject.h> +#include <qobject.h> class KQuickPadding : public QObject { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/plugin/kquickstyleitem.cpp new/qqc2-desktop-style-5.53.0/plugin/kquickstyleitem.cpp --- old/qqc2-desktop-style-5.52.0/plugin/kquickstyleitem.cpp 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/plugin/kquickstyleitem.cpp 2018-12-01 15:42:55.000000000 +0100 @@ -45,13 +45,25 @@ #include <qpainter.h> #include <qpixmapcache.h> #include <qstyle.h> +#include <qstylefactory.h> #include <qstyleoption.h> #include <qapplication.h> #include <qquickwindow.h> #include <QtQuick/qsgninepatchnode.h> +#include <ksharedconfig.h> +#include <kconfiggroup.h> + #include <Kirigami2/PlatformTheme> +QStyle *KQuickStyleItem::s_style = nullptr; + +QStyle *KQuickStyleItem::style() +{ + auto style = qApp->style(); + return style ? style : s_style; +} + KQuickStyleItem::KQuickStyleItem(QQuickItem *parent) : QQuickItem(parent), m_styleoption(nullptr), @@ -77,6 +89,16 @@ m_textureHeight(0), m_lastFocusReason(Qt::NoFocusReason) { + if (!qApp->style()) { + KSharedConfig::Ptr kdeglobals = KSharedConfig::openConfig(); + KConfigGroup cg(kdeglobals, "KDE"); + auto style = s_style; + s_style = QStyleFactory::create(cg.readEntry("widgetStyle", QStringLiteral("Fusion"))); + if (style) { + delete style; + } + } + m_font = qApp->font(); setFlag(QQuickItem::ItemHasContents, true); setSmooth(false); @@ -190,11 +212,23 @@ } else if (icon.canConvert<QString>()) { opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); } - int e = qApp->style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); - opt->iconSize = QSize(e, e); + auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); + if (iconSize.isEmpty()) { + int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); + if (iconSize.width() <= 0) { + iconSize.setWidth(e); + } + if (iconSize.height() <= 0) { + iconSize.setHeight(e); + } + } + opt->iconSize = iconSize; opt->features = activeControl() == QLatin1String("default") ? QStyleOptionButton::DefaultButton : QStyleOptionButton::None; + if (m_properties[QStringLiteral("flat")].toBool()) { + opt->features |= QStyleOptionButton::Flat; + } const QFont font = qApp->font("QPushButton"); opt->fontMetrics = QFontMetrics(font); QObject * menu = m_properties[QStringLiteral("menu")].value<QObject *>(); @@ -304,7 +338,7 @@ // For now both text and icon opt->toolButtonStyle = Qt::ToolButtonTextBesideIcon; - int e = qApp->style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); + int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); opt->iconSize = QSize(e, e); const QFont font = qApp->font("QToolButton"); @@ -357,8 +391,8 @@ QStyleOptionFrame *opt = qstyleoption_cast<QStyleOptionFrame*>(m_styleoption); opt->frameShape = QFrame::StyledPanel; - opt->lineWidth = 1; - opt->midLineWidth = 1; + opt->lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); + opt->midLineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); } break; case FocusRect: { @@ -481,7 +515,7 @@ m_styleoption = new QStyleOptionFrame(); QStyleOptionFrame *opt = qstyleoption_cast<QStyleOptionFrame*>(m_styleoption); - opt->lineWidth = 1; // this must be non-zero + opt->lineWidth = qMax(1, KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr)); //this must be non zero } break; case ComboBox :{ @@ -568,7 +602,7 @@ QStyleOptionGroupBox *opt = qstyleoption_cast<QStyleOptionGroupBox*>(m_styleoption); opt->text = text(); - opt->lineWidth = 1; + opt->lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); opt->subControls = QStyle::SC_GroupBoxLabel; opt->features = 0; if (m_properties[QStringLiteral("sunken")].toBool()) { // Qt draws an ugly line here so I ignore it @@ -603,7 +637,7 @@ opt->sliderValue = value(); opt->subControls = QStyle::SC_All; - setTransient(qApp->style()->styleHint(QStyle::SH_ScrollBar_Transient, m_styleoption)); + setTransient(KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_Transient, m_styleoption)); break; } default: @@ -734,9 +768,9 @@ * QFusionStyle = "fusion" */ -QString KQuickStyleItem::style() const +QString KQuickStyleItem::styleName() const { - QString style = QString::fromLatin1(qApp->style()->metaObject()->className()); + QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); style = style.toLower(); if (style.startsWith(QLatin1Char('q'))) style = style.right(style.length() - 1); @@ -750,7 +784,7 @@ QStyle::SubControl subcontrol = QStyle::SC_All; switch (m_itemType) { case SpinBox :{ - subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_SpinBox, + subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_SpinBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SpinBoxUp) @@ -761,7 +795,7 @@ break; case Slider: { - subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_Slider, + subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_Slider, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SliderHandle) @@ -770,7 +804,7 @@ break; case ScrollBar: { - subcontrol = qApp->style()->hitTestComplexControl(QStyle::CC_ScrollBar, + subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), QPoint(px,py), nullptr); switch (subcontrol) { @@ -808,13 +842,13 @@ QSize size; switch (m_itemType) { case RadioButton: - size = qApp->style()->sizeFromContents(QStyle::CT_RadioButton, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_RadioButton, m_styleoption, QSize(width,height)); break; case CheckBox: - size = qApp->style()->sizeFromContents(QStyle::CT_CheckBox, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_CheckBox, m_styleoption, QSize(width,height)); break; case ToolBar: - size = QSize(200, style().contains(QLatin1String("windows")) ? 30 : 42); + size = QSize(200, styleName().contains(QLatin1String("windows")) ? 30 : 42); break; case ToolButton: { QStyleOptionToolButton *btn = qstyleoption_cast<QStyleOptionToolButton*>(m_styleoption); @@ -842,50 +876,57 @@ } } btn->rect.setSize(QSize(w, h)); - size = qApp->style()->sizeFromContents(QStyle::CT_ToolButton, m_styleoption, QSize(w, h)); } + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ToolButton, m_styleoption, QSize(w, h)); } break; case Button: { QStyleOptionButton *btn = qstyleoption_cast<QStyleOptionButton*>(m_styleoption); int contentWidth = btn->fontMetrics.width(btn->text); int contentHeight = btn->fontMetrics.height(); + if (!btn->icon.isNull()) { //+4 matches a hardcoded value in QStyle and acts as a margin between the icon and the text. contentWidth += btn->iconSize.width() + 4; contentHeight = qMax(btn->fontMetrics.height(), btn->iconSize.height()); } + int newWidth = qMax(width, contentWidth); int newHeight = qMax(height, contentHeight); - size = qApp->style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); } + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); } break; case ComboBox: { QStyleOptionComboBox *btn = qstyleoption_cast<QStyleOptionComboBox*>(m_styleoption); int newWidth = qMax(width, btn->fontMetrics.width(btn->currentText)); int newHeight = qMax(height, btn->fontMetrics.height()); - size = qApp->style()->sizeFromContents(QStyle::CT_ComboBox, m_styleoption, QSize(newWidth, newHeight)); } + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ComboBox, m_styleoption, QSize(newWidth, newHeight)); } break; case Tab: - size = qApp->style()->sizeFromContents(QStyle::CT_TabBarTab, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_TabBarTab, m_styleoption, QSize(width,height)); break; case Slider: - size = qApp->style()->sizeFromContents(QStyle::CT_Slider, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_Slider, m_styleoption, QSize(width,height)); break; case ProgressBar: - size = qApp->style()->sizeFromContents(QStyle::CT_ProgressBar, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ProgressBar, m_styleoption, QSize(width,height)); break; case SpinBox: case Edit: { // We have to create a new style option since we might be calling with a QStyleOptionSpinBox QStyleOptionFrame frame; - frame.state = m_styleoption->state; - frame.lineWidth = qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); + //+2 to be consistent with the hardcoded verticalmargin in QLineEdit + int contentHeight = frame.fontMetrics.height() + 2; + + frame.state = m_styleoption->state | QStyle::State_Sunken; + frame.lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); frame.rect = m_styleoption->rect; frame.styleObject = this; - size = qApp->style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, height)); - if (m_itemType == SpinBox) - size.setWidth(qApp->style()->sizeFromContents(QStyle::CT_SpinBox, - m_styleoption, QSize(width + 2, height)).width()); + + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, qMax(height, contentHeight)).expandedTo(QApplication::globalStrut())); + if (m_itemType == SpinBox) { + size.setWidth(KQuickStyleItem::style()->sizeFromContents(QStyle::CT_SpinBox, + m_styleoption, QSize(width + 2, height)).width()); + } } break; case GroupBox: { @@ -894,36 +935,36 @@ int baseWidth = metrics.width(box->text) + metrics.width(QLatin1Char(' ')); int baseHeight = metrics.height() + m_contentHeight; if (box->subControls & QStyle::SC_GroupBoxCheckBox) { - baseWidth += qApp->style()->pixelMetric(QStyle::PM_IndicatorWidth); - baseWidth += qApp->style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing); - baseHeight = qMax(baseHeight, qApp->style()->pixelMetric(QStyle::PM_IndicatorHeight)); + baseWidth += KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth); + baseWidth += KQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing); + baseHeight = qMax(baseHeight, KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorHeight)); } - size = qApp->style()->sizeFromContents(QStyle::CT_GroupBox, m_styleoption, QSize(qMax(baseWidth, m_contentWidth), baseHeight)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_GroupBox, m_styleoption, QSize(qMax(baseWidth, m_contentWidth), baseHeight)); } break; case Header: - size = qApp->style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height)); break; case ItemRow: case Item: //fall through - size = qApp->style()->sizeFromContents(QStyle::CT_ItemViewItem, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ItemViewItem, m_styleoption, QSize(width,height)); break; case MenuBarItem: - size = qApp->style()->sizeFromContents(QStyle::CT_MenuBarItem, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBarItem, m_styleoption, QSize(width,height)); break; case MenuBar: - size = qApp->style()->sizeFromContents(QStyle::CT_MenuBar, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBar, m_styleoption, QSize(width,height)); break; case Menu: - size = qApp->style()->sizeFromContents(QStyle::CT_Menu, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_Menu, m_styleoption, QSize(width,height)); break; case MenuItem: case ComboBoxItem: if (static_cast<QStyleOptionMenuItem *>(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller) { size.setHeight(qMax(QApplication::globalStrut().height(), - qApp->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, nullptr))); + KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, nullptr))); } else { - size = qApp->style()->sizeFromContents(QStyle::CT_MenuItem, m_styleoption, QSize(width,height)); + size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuItem, m_styleoption, QSize(width,height)); } break; default: @@ -938,27 +979,27 @@ bool ceilResult = true; // By default baseline offset rounding is done upwards switch (m_itemType) { case RadioButton: - r = qApp->style()->subElementRect(QStyle::SE_RadioButtonContents, m_styleoption); + r = KQuickStyleItem::style()->subElementRect(QStyle::SE_RadioButtonContents, m_styleoption); break; case Button: - r = qApp->style()->subElementRect(QStyle::SE_PushButtonContents, m_styleoption); + r = KQuickStyleItem::style()->subElementRect(QStyle::SE_PushButtonContents, m_styleoption); break; case CheckBox: - r = qApp->style()->subElementRect(QStyle::SE_CheckBoxContents, m_styleoption); + r = KQuickStyleItem::style()->subElementRect(QStyle::SE_CheckBoxContents, m_styleoption); break; case Edit: - r = qApp->style()->subElementRect(QStyle::SE_LineEditContents, m_styleoption); + r = KQuickStyleItem::style()->subElementRect(QStyle::SE_LineEditContents, m_styleoption); break; case ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(m_styleoption)) { - r = qApp->style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField); - if (style() != QLatin1String("mac")) + r = KQuickStyleItem::style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField); + if (styleName() != QLatin1String("mac")) r.adjust(0,0,0,1); } break; case SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(m_styleoption)) { - r = qApp->style()->subControlRect(QStyle::CC_SpinBox, spinbox, QStyle::SC_SpinBoxEditField); + r = KQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, spinbox, QStyle::SC_SpinBoxEditField); ceilResult = false; } break; @@ -1016,59 +1057,59 @@ int KQuickStyleItem::pixelMetric(const QString &metric) { if (metric == QLatin1String("scrollbarExtent")) - return qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); else if (metric == QLatin1String("defaultframewidth")) - return qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); else if (metric == QLatin1String("taboverlap")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); else if (metric == QLatin1String("tabbaseoverlap")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); else if (metric == QLatin1String("tabhspace")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); else if (metric == QLatin1String("indicatorwidth")) - return qApp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); else if (metric == QLatin1String("tabvspace")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); else if (metric == QLatin1String("tabbaseheight")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); else if (metric == QLatin1String("tabvshift")) - return qApp->style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); else if (metric == QLatin1String("menubarhmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); else if (metric == QLatin1String("menubarvmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); else if (metric == QLatin1String("menubarpanelwidth")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); else if (metric == QLatin1String("menubaritemspacing")) - return qApp->style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); else if (metric == QLatin1String("spacebelowmenubar")) - return qApp->style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); + return KQuickStyleItem::style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); else if (metric == QLatin1String("menuhmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); else if (metric == QLatin1String("menuvmargin")) - return qApp->style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); else if (metric == QLatin1String("menupanelwidth")) - return qApp->style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); else if (metric == QLatin1String("submenuoverlap")) - return qApp->style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); else if (metric == QLatin1String("splitterwidth")) - return qApp->style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); else if (metric == QLatin1String("scrollbarspacing")) - return abs(qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); + return abs(KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); else if (metric == QLatin1String("treeviewindentation")) - return qApp->style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); else if (metric == QLatin1String("layouthorizontalspacing")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, nullptr); else if (metric == QLatin1String("layoutverticalspacing")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr); else if (metric == QLatin1String("layoutleftmargin")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr); else if (metric == QLatin1String("layouttopmargin")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr); else if (metric == QLatin1String("layoutrightmargin")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr); else if (metric == QLatin1String("layoutbottommargin")) - return qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr); + return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr); return 0; } @@ -1076,7 +1117,7 @@ { initStyleOption(); if (metric == QLatin1String("comboboxpopup")) { - return qApp->style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption); + return KQuickStyleItem::style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption); } else if (metric == QLatin1String("highlightedTextColor")) { return m_styleoption->palette.highlightedText().color().name(); } else if (metric == QLatin1String("textColor")) { @@ -1084,20 +1125,20 @@ pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive); return pal.text().color().name(); } else if (metric == QLatin1String("focuswidget")) { - return qApp->style()->styleHint(QStyle::SH_FocusFrame_AboveWidget); + return KQuickStyleItem::style()->styleHint(QStyle::SH_FocusFrame_AboveWidget); } else if (metric == QLatin1String("tabbaralignment")) { - int result = qApp->style()->styleHint(QStyle::SH_TabBar_Alignment); + int result = KQuickStyleItem::style()->styleHint(QStyle::SH_TabBar_Alignment); if (result == Qt::AlignCenter) return QStringLiteral("center"); return QStringLiteral("left"); } else if (metric == QLatin1String("externalScrollBars")) { - return qApp->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); + return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); } else if (metric == QLatin1String("scrollToClickPosition")) - return qApp->style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition); + return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition); else if (metric == QLatin1String("activateItemOnSingleClick")) - return qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); + return KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); else if (metric == QLatin1String("submenupopupdelay")) - return qApp->style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); + return KQuickStyleItem::style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); else if (metric == QLatin1String("wheelScrollLines")) return qApp->wheelScrollLines(); return 0; @@ -1231,7 +1272,7 @@ else if (subcontrolString == QLatin1String("edit")){ subcontrol = QStyle::SC_SpinBoxEditField; } - return qApp->style()->subControlRect(control, + return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), subcontrol); @@ -1244,7 +1285,7 @@ subcontrol = QStyle::SC_SliderHandle; else if (subcontrolString == QLatin1String("groove")) subcontrol = QStyle::SC_SliderGroove; - return qApp->style()->subControlRect(control, + return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), subcontrol); @@ -1263,7 +1304,7 @@ subcontrol = QStyle::SC_ScrollBarAddPage; else if (subcontrolString == QLatin1String("sub")) subcontrol = QStyle::SC_ScrollBarSubPage; - return qApp->style()->subControlRect(control, + return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), subcontrol); } @@ -1271,7 +1312,7 @@ case ItemBranchIndicator: { QStyleOption opt; opt.rect = QRect(0, 0, implicitWidth(), implicitHeight()); - return qApp->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, nullptr); + return KQuickStyleItem::style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, nullptr); } default: break; @@ -1323,7 +1364,7 @@ switch (m_itemType) { case Button: - qApp->style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter); break; case ItemRow :{ QPixmap pixmap; @@ -1334,8 +1375,8 @@ pixmap = QPixmap(newSize, height()); pixmap.fill(Qt::transparent); QPainter pixpainter(&pixmap); - qApp->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter); - if ((style() == QLatin1String("mac") || !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) { + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter); + if ((styleName() == QLatin1String("mac") || !KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) { QPalette pal = QApplication::palette("QAbstractItemView"); pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup()); pixpainter.fillRect(m_styleoption->rect, pal.highlight()); @@ -1346,119 +1387,118 @@ } break; case Item: - qApp->style()->drawControl(QStyle::CE_ItemViewItem, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_ItemViewItem, m_styleoption, painter); break; case ItemBranchIndicator: - qApp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_IndicatorBranch, m_styleoption, painter); break; case Header: - qApp->style()->drawControl(QStyle::CE_Header, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_Header, m_styleoption, painter); break; case ToolButton: - qApp->style()->drawComplexControl(QStyle::CC_ToolButton, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ToolButton, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case Tab: { if (m_lastFocusReason != Qt::TabFocusReason && m_lastFocusReason != Qt::BacktabFocusReason) { m_styleoption->state &= ~QStyle::State_HasFocus; } - qApp->style()->drawControl(QStyle::CE_TabBarTab, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_TabBarTab, m_styleoption, painter); } break; case Frame: - qApp->style()->drawControl(QStyle::CE_ShapedFrame, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_ShapedFrame, m_styleoption, painter); break; case FocusFrame: - qApp->style()->drawControl(QStyle::CE_FocusFrame, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_FocusFrame, m_styleoption, painter); break; case FocusRect: - qApp->style()->drawPrimitive(QStyle::PE_FrameFocusRect, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameFocusRect, m_styleoption, painter); break; case TabFrame: - qApp->style()->drawPrimitive(QStyle::PE_FrameTabWidget, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameTabWidget, m_styleoption, painter); break; case MenuBar: - qApp->style()->drawControl(QStyle::CE_MenuBarEmptyArea, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarEmptyArea, m_styleoption, painter); break; case MenuBarItem: - qApp->style()->drawControl(QStyle::CE_MenuBarItem, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarItem, m_styleoption, painter); break; case MenuItem: case ComboBoxItem: { // fall through QStyle::ControlElement menuElement = static_cast<QStyleOptionMenuItem *>(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller ? QStyle::CE_MenuScroller : QStyle::CE_MenuItem; - qApp->style()->drawControl(menuElement, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(menuElement, m_styleoption, painter); } break; case CheckBox: - qApp->style()->drawControl(QStyle::CE_CheckBox, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_CheckBox, m_styleoption, painter); break; case RadioButton: - qApp->style()->drawControl(QStyle::CE_RadioButton, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_RadioButton, m_styleoption, painter); break; - case Edit: { - qApp->style()->drawPrimitive(QStyle::PE_PanelLineEdit, m_styleoption, painter); - } + case Edit: + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelLineEdit, m_styleoption, painter); break; case MacHelpButton: //Not managed as mac is not supported break; case Widget: - qApp->style()->drawPrimitive(QStyle::PE_Widget, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_Widget, m_styleoption, painter); break; case ScrollAreaCorner: - qApp->style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, m_styleoption, painter); break; case Splitter: if (m_styleoption->rect.width() == 1) painter->fillRect(0, 0, width(), height(), m_styleoption->palette.dark().color()); else - qApp->style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter); break; case ComboBox: { - qApp->style()->drawComplexControl(QStyle::CC_ComboBox, + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ComboBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); // This is needed on mac as it will use the painter color and ignore the palette QPen pen = painter->pen(); painter->setPen(m_styleoption->palette.text().color()); - qApp->style()->drawControl(QStyle::CE_ComboBoxLabel, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_ComboBoxLabel, m_styleoption, painter); painter->setPen(pen); } break; case SpinBox: #ifdef Q_OS_MAC // macstyle depends on the embedded qlineedit to fill the editfield background - if (style() == QLatin1String("mac")) { - QRect editRect = qApp->style()->subControlRect(QStyle::CC_SpinBox, + if (styleName() == QLatin1String("mac")) { + QRect editRect = KQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), QStyle::SC_SpinBoxEditField); painter->fillRect(editRect.adjusted(-1, -1, 1, 1), m_styleoption->palette.base()); } #endif - qApp->style()->drawComplexControl(QStyle::CC_SpinBox, + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_SpinBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case Slider: - qApp->style()->drawComplexControl(QStyle::CC_Slider, + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_Slider, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case Dial: - qApp->style()->drawComplexControl(QStyle::CC_Dial, + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_Dial, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case ProgressBar: - qApp->style()->drawControl(QStyle::CE_ProgressBar, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_ProgressBar, m_styleoption, painter); break; case ToolBar: painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); - qApp->style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter); + KQuickStyleItem::style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter); painter->save(); - painter->setPen(style() != QLatin1String("fusion") ? m_styleoption->palette.dark().color().darker(120) : + painter->setPen(styleName() != QLatin1String("fusion") ? m_styleoption->palette.dark().color().darker(120) : m_styleoption->palette.window().color().lighter(107)); painter->drawLine(m_styleoption->rect.bottomLeft(), m_styleoption->rect.bottomRight()); painter->restore(); @@ -1468,25 +1508,25 @@ painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); painter->setPen(m_styleoption->palette.dark().color().darker(120)); painter->drawLine(m_styleoption->rect.topLeft(), m_styleoption->rect.topRight()); - qApp->style()->drawPrimitive(QStyle::PE_PanelStatusBar, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelStatusBar, m_styleoption, painter); } break; case GroupBox: - qApp->style()->drawComplexControl(QStyle::CC_GroupBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_GroupBox, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case ScrollBar: - qApp->style()->drawComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); + KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast<QStyleOptionComplex*>(m_styleoption), painter); break; case Menu: { QStyleHintReturnMask val; - qApp->style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, nullptr, &val); + KQuickStyleItem::style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, nullptr, &val); painter->save(); painter->setClipRegion(val.region); painter->fillRect(m_styleoption->rect, m_styleoption->palette.window()); painter->restore(); - qApp->style()->drawPrimitive(QStyle::PE_PanelMenu, m_styleoption, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelMenu, m_styleoption, painter); - if (int fw = qApp->style()->pixelMetric(QStyle::PM_MenuPanelWidth)) { + if (int fw = KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth)) { QStyleOptionFrame frame; frame.state = QStyle::State_None; frame.lineWidth = fw; @@ -1494,7 +1534,7 @@ frame.rect = m_styleoption->rect; frame.styleObject = this; frame.palette = m_styleoption->palette; - qApp->style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter); } } break; @@ -1613,7 +1653,7 @@ #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(styleNode, QString::fromLatin1("%1:%2, '%3'") - .arg(style()) + .arg(styleName()) .arg(elementType()) .arg(text())); #endif @@ -1679,7 +1719,7 @@ QStyleOptionViewItem opt; opt.state |= QStyle::State_Enabled; opt.rect = QRect(0, 0, width, height); - QString style = QString::fromLatin1(qApp->style()->metaObject()->className()); + QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); opt.features = 0; if (id.contains(QLatin1String("selected"))) @@ -1696,13 +1736,13 @@ QPalette pal = QApplication::palette("QAbstractItemView"); if (opt.state & QStyle::State_Selected && (style.contains(QLatin1String("Mac")) || - !qApp->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected))) { + !KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected))) { pal.setCurrentColorGroup(opt.palette.currentColorGroup()); pixmap.fill(pal.highlight().color()); } else { pixmap.fill(pal.base().color()); QPainter pixpainter(&pixmap); - qApp->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, &pixpainter); + KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, &pixpainter); } return pixmap; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.52.0/plugin/kquickstyleitem_p.h new/qqc2-desktop-style-5.53.0/plugin/kquickstyleitem_p.h --- old/qqc2-desktop-style-5.52.0/plugin/kquickstyleitem_p.h 2018-11-03 13:03:21.000000000 +0100 +++ new/qqc2-desktop-style-5.53.0/plugin/kquickstyleitem_p.h 2018-12-01 15:42:55.000000000 +0100 @@ -50,6 +50,7 @@ class QWidget; class QStyleOption; +class QStyle; namespace Kirigami { class PlatformTheme; @@ -82,7 +83,7 @@ Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged) Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged) - Q_PROPERTY( QString style READ style NOTIFY styleChanged) + Q_PROPERTY( QString styleName READ styleName NOTIFY styleChanged) Q_PROPERTY( QVariantMap hints READ hints WRITE setHints NOTIFY hintChanged RESET resetHints) Q_PROPERTY( QVariantMap properties READ properties WRITE setProperties NOTIFY propertiesChanged) Q_PROPERTY( QFont font READ font NOTIFY fontChanged) @@ -175,7 +176,7 @@ QVariantMap hints() const { return m_hints; } QVariantMap properties() const { return m_properties; } QFont font() const { return m_font;} - QString style() const; + QString styleName() const; void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}} @@ -219,6 +220,8 @@ QQuickItem *control() const; void setControl(QQuickItem *control); + static QStyle *style(); + public Q_SLOTS: int pixelMetric(const QString&); QVariant styleHint(const QString&); @@ -314,6 +317,8 @@ QImage m_image; KQuickPadding m_border; + + static QStyle *s_style; };
