Hello community, here is the log from the commit of package qqc2-desktop-style for openSUSE:Factory checked in at 2020-11-19 11:52:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qqc2-desktop-style (Old) and /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qqc2-desktop-style" Thu Nov 19 11:52:16 2020 rev:40 rq:848595 version:5.76.0 Changes: -------- --- /work/SRC/openSUSE:Factory/qqc2-desktop-style/qqc2-desktop-style.changes 2020-10-12 13:58:59.602208059 +0200 +++ /work/SRC/openSUSE:Factory/.qqc2-desktop-style.new.5913/qqc2-desktop-style.changes 2020-11-23 10:47:31.958424769 +0100 @@ -1,0 +2,18 @@ +Sat Nov 7 21:35:35 UTC 2020 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 5.76.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/kde-frameworks-5.76.0 +- Changes since 5.75.0: + * Fix ToolBar contentWidth binding loop + * Reference shortcut label directly by id instead of implicitly + * ComboBox.contentItem must be a QQuickTextInput to fix autocomplete (kde#425865) + * Simplify conditional clauses in Connections + * Fix Connections warning on ComboBox + * Add support for qrc icons to StyleItem (kde#427449) + * Properly indicate focus state of ToolButton + * Add TextFieldContextMenu for right click context menus on TextField and TextArea + * Set background color to ComboBox's ScrollView + +------------------------------------------------------------------- Old: ---- qqc2-desktop-style-5.75.0.tar.xz qqc2-desktop-style-5.75.0.tar.xz.sig New: ---- qqc2-desktop-style-5.76.0.tar.xz qqc2-desktop-style-5.76.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qqc2-desktop-style.spec ++++++ --- /var/tmp/diff_new_pack.vaLYjT/_old 2020-11-23 10:47:32.450425261 +0100 +++ /var/tmp/diff_new_pack.vaLYjT/_new 2020-11-23 10:47:32.454425264 +0100 @@ -16,11 +16,11 @@ # -%define _tar_path 5.75 +%define _tar_path 5.76 # Only needed for the package signature condition %bcond_without lang Name: qqc2-desktop-style -Version: 5.75.0 +Version: 5.76.0 Release: 0 Summary: A Qt Quick Controls 2 Style for Desktop UIs License: GPL-2.0-or-later ++++++ qqc2-desktop-style-5.75.0.tar.xz -> qqc2-desktop-style-5.76.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/CMakeLists.txt new/qqc2-desktop-style-5.76.0/CMakeLists.txt --- old/qqc2-desktop-style-5.75.0/CMakeLists.txt 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/CMakeLists.txt 2020-11-07 12:47:00.000000000 +0100 @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.75.0") # handled by release scripts -set(KF5_DEP_VERSION "5.75.0") # handled by release scripts +set(KF5_VERSION "5.76.0") # handled by release scripts +set(KF5_DEP_VERSION "5.76.0") # handled by release scripts project(qqc2-desktop-style VERSION ${KF5_VERSION}) @@ -21,7 +21,7 @@ ################# set KDE specific information ################# -find_package(ECM 5.75.0 REQUIRED NO_MODULE) +find_package(ECM 5.76.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}) @@ -110,7 +110,7 @@ ######################################################################### add_definitions(-DQT_NO_FOREACH) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) -add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054900) +add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054B00) add_subdirectory(plugin) if (KF5IconThemes_FOUND AND KF5WidgetsAddons_FOUND) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/ComboBox.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/ComboBox.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/ComboBox.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/ComboBox.qml 2020-11-07 12:47:00.000000000 +0100 @@ -34,7 +34,7 @@ delegate: ItemDelegate { width: listView.width text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData - highlighted: mouseArea.pressed ? listView.currentIndex == index : controlRoot.highlightedIndex == index + highlighted: 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 @@ -42,116 +42,50 @@ indicator: Item {} - StylePrivate.PropertyWriter { - id: controlRootWriter - target: controlRoot - propertyName: 'currentIndex' - } - - 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.incrementCurrentIndex(); - } else { - controlRoot.decrementCurrentIndex(); + contentItem: T.TextField { + id: textField + padding: 0 + 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 : null + + font: controlRoot.font + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + opacity: controlRoot.enabled ? 1 : 0.3 + + onFocusChanged: { + if (focus) { + Private.MobileTextActionsToolBar.controlRoot = textField; } } - onPressed: { - if (controlRoot.focusPolicy & Qt.ClickFocus) { - controlRoot.forceActiveFocus(); - } - 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) { - controlRootWriter.writeProperty(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 : null - - font: controlRoot.font - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - opacity: controlRoot.enabled ? 1 : 0.3 - - onFocusChanged: { - if (focus) { - Private.MobileTextActionsToolBar.controlRoot = textField; - } - } - - onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; - onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; - - onPressAndHold: { - if (!Kirigami.Settings.tabletMode) { - return; - } - forceActiveFocus(); - cursorPosition = positionAt(event.x, event.y); - selectWord(); - } + onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; + onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; + + onPressAndHold: { + if (!Kirigami.Settings.tabletMode) { + return; + } + forceActiveFocus(); + cursorPosition = positionAt(event.x, event.y); + selectWord(); } } @@ -185,6 +119,22 @@ 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.incrementCurrentIndex(); + } else { + controlRoot.decrementCurrentIndex(); + } + } + } } popup: T.Popup { @@ -206,7 +156,9 @@ Controls.Overlay.modal: Item { } contentItem: ScrollView { - background: Rectangle {} + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { id: listView diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/Menu.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/Menu.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/Menu.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/Menu.qml 2020-11-07 12:47:00.000000000 +0100 @@ -50,11 +50,8 @@ Connections { target: control.contentItem.contentItem -@DISABLE_UNDER_QT_5_14@ function - onChildrenChanged -@DISABLE_UNDER_QT_5_14@ () -@DISABLE_AT_QT_5_14@ : - { +@DISABLE_AT_QT_5_14@ onChildrenChanged: { +@DISABLE_UNDER_QT_5_14@ function onChildrenChanged() { for (var i in control.contentItem.contentItem.children) { var child = control.contentItem.contentItem.children[i]; if (child.checkable) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/MenuItem.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/MenuItem.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/MenuItem.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/MenuItem.qml 2020-11-07 12:47:00.000000000 +0100 @@ -80,7 +80,7 @@ Shortcut { id: itemShortcut - sequence: (parent.visible && controlRoot.action !== null) ? controlRoot.action.shortcut : "" + sequence: (shortcut.visible && controlRoot.action !== null) ? controlRoot.action.shortcut : "" } text: visible ? itemShortcut.nativeText : "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/TextArea.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/TextArea.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/TextArea.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/TextArea.qml 2020-11-07 12:47:00.000000000 +0100 @@ -6,7 +6,7 @@ */ -import QtQuick 2.6 +import QtQuick 2.12 import QtQuick.Window 2.1 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami @@ -52,6 +52,21 @@ onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; + TapHandler { + acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus + acceptedButtons: Qt.LeftButton | Qt.RightButton + + // unfortunately, taphandler's pressed event only triggers when the press is lifted + // we need to use the longpress signal since it triggers when the button is first pressed + longPressThreshold: 0 + onLongPressed: Private.TextFieldContextMenu.targetClick(point, controlRoot); + } + + Keys.onPressed: { + // trigger if context menu button is pressed + Private.TextFieldContextMenu.targetKeyPressed(event, controlRoot) + } + onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/TextField.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/TextField.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/TextField.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/TextField.qml 2020-11-07 12:47:00.000000000 +0100 @@ -6,7 +6,7 @@ */ -import QtQuick 2.6 +import QtQuick 2.12 import QtQuick.Window 2.1 import QtQuick.Controls @QQC2_VERSION@ as Controls import QtQuick.Templates @QQC2_VERSION@ as T @@ -54,7 +54,23 @@ } onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; + onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; + + TapHandler { + acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus + acceptedButtons: Qt.LeftButton | Qt.RightButton + + // unfortunately, taphandler's pressed event only triggers when the press is lifted + // we need to use the longpress signal since it triggers when the button is first pressed + longPressThreshold: 0 + onLongPressed: Private.TextFieldContextMenu.targetClick(point, controlRoot); + } + + Keys.onPressed: { + // trigger if context menu button is pressed + Private.TextFieldContextMenu.targetKeyPressed(event, controlRoot) + } onPressAndHold: { if (!Kirigami.Settings.tabletMode) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/ToolBar.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/ToolBar.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/ToolBar.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/ToolBar.qml 2020-11-07 12:47:00.000000000 +0100 @@ -14,11 +14,9 @@ id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette - implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) - contentWidth: contentChildren[0].implicitWidth - contentHeight: contentChildren[0].implicitHeight + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) padding: Kirigami.Units.smallSpacing contentItem: Item {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/ToolButton.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/ToolButton.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/ToolButton.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/ToolButton.qml 2020-11-07 12:47:00.000000000 +0100 @@ -42,7 +42,7 @@ on: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked) hover: controlRoot.hovered text: controlRoot.Kirigami.MnemonicData.mnemonicLabel - hasFocus: !controlRoot.flat && controlRoot.pressed + hasFocus: controlRoot.visualFocus || (!controlRoot.flat && controlRoot.pressed) activeControl: controlRoot.isDefault ? "default" : "f" raised: !controlRoot.flat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/private/TextFieldContextMenu.qml new/qqc2-desktop-style-5.76.0/org.kde.desktop/private/TextFieldContextMenu.qml --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/private/TextFieldContextMenu.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/private/TextFieldContextMenu.qml 2020-11-07 12:47:00.000000000 +0100 @@ -0,0 +1,188 @@ +/* + SPDX-FileCopyrightText: 2020 Devin Lin <espi...@gmail.com> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +pragma Singleton + +import QtQuick 2.6 +import QtQuick.Controls @QQC2_VERSION@ +import org.kde.kirigami 2.5 as Kirigami + +Menu { + id: contextMenu + + property Item target + property bool deselectWhenMenuClosed: true + property int restoredCursorPosition: 0 + property int restoredSelectionStart + property int restoredSelectionEnd + property bool persistentSelectionSetting + Component.onCompleted: persistentSelectionSetting = persistentSelectionSetting // break binding + + property var runOnMenuClose + + function storeCursorAndSelection() { + contextMenu.restoredCursorPosition = target.cursorPosition; + contextMenu.restoredSelectionStart = target.selectionStart; + contextMenu.restoredSelectionEnd = target.selectionEnd; + } + + // target is pressed with mouse + function targetClick(handlerPoint, newTarget) { + if (handlerPoint.pressedButtons === Qt.RightButton) { // only accept just right click + if (contextMenu.visible) { + deselectWhenMenuClosed = false; // don't deselect text if menu closed by right click on textfield + close(); + } else { + // only change parent text field if the menu is opening + contextMenu.parent = newTarget; + contextMenu.z = newTarget.z + 1; + contextMenu.target = newTarget; + + target.persistentSelection = true; // persist selection when menu is opened + storeCursorAndSelection(); + popup(handlerPoint.position.x + 1, handlerPoint.position.y + 1); // slightly locate context menu away from mouse so no item is selected when menu is opened + } + } else { + close(); + } + } + + // context menu keyboard key + function targetKeyPressed(event, newTarget) { + if (event.modifiers === Qt.NoModifier && event.key === Qt.Key_Menu) { + // change parent text field + contextMenu.parent = newTarget; + contextMenu.z = newTarget.z + 1; + contextMenu.target = newTarget; + + target.persistentSelection = true; // persist selection when menu is opened + storeCursorAndSelection(); + popup(); + } + } + + readonly property bool targetIsPassword: target !== null && (target.echoMode === TextInput.PasswordEchoOnEdit || target.echoMode === TextInput.Password) + + // deal with whether or not text should be deselected + onClosed: { + // restore text field's original persistent selection setting + target.persistentSelection = persistentSelectionSetting + // deselect text field text if menu is closed not because of a right click on the text field + if (deselectWhenMenuClosed) { + target.deselect(); + } + deselectWhenMenuClosed = true; + + // restore cursor position + target.forceActiveFocus(); + target.cursorPosition = restoredCursorPosition; + target.select(restoredSelectionStart, restoredSelectionEnd); + + // run action + runOnMenuClose(); + } + + onOpened: { + runOnMenuClose = function() {}; + } + + MenuItem { + visible: target !== null && !target.readOnly + action: Action { + icon.name: "edit-undo-symbolic" + text: i18nc("@action:inmenu", "Undo") + shortcut: StandardKey.Undo + } + enabled: target !== null && target.canUndo + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.undo()}; + } + } + MenuItem { + visible: target !== null && !target.readOnly + action: Action { + icon.name: "edit-redo-symbolic" + text: i18nc("@action:inmenu", "Redo") + shortcut: StandardKey.Redo + } + enabled: target !== null && target.canRedo + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.redo()}; + } + } + MenuSeparator { + visible: target !== null && !target.readOnly + } + MenuItem { + visible: target !== null && !target.readOnly && !targetIsPassword + action: Action { + icon.name: "edit-cut-symbolic" + text: i18nc("@action:inmenu", "Cut") + shortcut: StandardKey.Cut + } + enabled: target !== null && target.selectedText + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.cut()} + } + } + MenuItem { + action: Action { + icon.name: "edit-copy-symbolic" + text: i18nc("@action:inmenu", "Copy") + shortcut: StandardKey.Copy + } + enabled: target !== null && target.selectedText + visible: !targetIsPassword + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.copy()} + } + } + MenuItem { + visible: target !== null && !target.readOnly + action: Action { + icon.name: "edit-paste-symbolic" + text: i18nc("@action:inmenu", "Paste") + shortcut: StandardKey.Paste + } + enabled: target !== null && target.canPaste + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.paste()}; + } + } + MenuItem { + visible: target !== null && !target.readOnly + action: Action { + icon.name: "edit-delete-symbolic" + text: i18nc("@action:inmenu", "Delete") + shortcut: StandardKey.Delete + } + enabled: target !== null && target.selectedText + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.remove(target.selectionStart, target.selectionEnd)}; + } + } + MenuSeparator { + visible: !targetIsPassword + } + MenuItem { + action: Action { + icon.name: "edit-select-all-symbolic" + text: i18nc("@action:inmenu", "Select All") + shortcut: StandardKey.SelectAll + } + visible: !targetIsPassword + onTriggered: { + deselectWhenMenuClosed = false; + runOnMenuClose = function() {target.selectAll()}; + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/org.kde.desktop/private/qmldir new/qqc2-desktop-style-5.76.0/org.kde.desktop/private/qmldir --- old/qqc2-desktop-style-5.75.0/org.kde.desktop/private/qmldir 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/org.kde.desktop/private/qmldir 2020-11-07 12:47:00.000000000 +0100 @@ -3,3 +3,4 @@ DefaultListItemBackground 1.0 DefaultListItemBackground.qml MobileCursor 1.0 MobileCursor.qml FocusRect 1.0 FocusRect.qml +singleton TextFieldContextMenu 1.0 TextFieldContextMenu.qml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/plugin/kquickstyleitem.cpp new/qqc2-desktop-style-5.76.0/plugin/kquickstyleitem.cpp --- old/qqc2-desktop-style-5.75.0/plugin/kquickstyleitem.cpp 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/plugin/kquickstyleitem.cpp 2020-11-07 12:47:00.000000000 +0100 @@ -179,14 +179,8 @@ QStyleOptionButton *opt = qstyleoption_cast<QStyleOptionButton*>(m_styleoption); opt->text = text(); - const QVariant icon = m_properties[QStringLiteral("icon")]; - if (icon.canConvert<QIcon>()) { - opt->icon = icon.value<QIcon>(); - } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) { - opt->icon = QIcon(icon.value<QUrl>().toLocalFile()); - } else if (icon.canConvert<QString>()) { - opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); - } + opt->icon = iconFromIconProperty(); + 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); @@ -303,12 +297,9 @@ opt->activeSubControls = QStyle::SC_ToolButton; opt->text = text(); - const QVariant icon = m_properties[QStringLiteral("icon")]; - if (icon.canConvert<QIcon>()) { - opt->icon = icon.value<QIcon>(); - } else if (icon.canConvert<QString>()) { - opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); - } + + opt->icon = iconFromIconProperty(); + auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); @@ -483,8 +474,7 @@ QStyleOptionMenuItem::NonExclusive; } } - if (m_properties[QStringLiteral("icon")].canConvert<QIcon>()) - opt->icon = m_properties[QStringLiteral("icon")].value<QIcon>(); + opt->icon = iconFromIconProperty(); setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool()); const QFont font = qApp->font(m_itemType == ComboBoxItem ?"QComboMenuItem" : "QMenu"); @@ -507,14 +497,8 @@ opt->state |= QStyle::State_NoChange; opt->text = text(); - const QVariant icon = m_properties[QStringLiteral("icon")]; - if (icon.canConvert<QIcon>()) { - opt->icon = icon.value<QIcon>(); - } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) { - opt->icon = QIcon(icon.value<QUrl>().toLocalFile()); - } else if (icon.canConvert<QString>()) { - opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>()); - } + opt->icon = iconFromIconProperty(); + 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); @@ -742,6 +726,35 @@ } +QIcon KQuickStyleItem::iconFromIconProperty() const +{ + QIcon icon; + const QVariant iconProperty = m_properties[QStringLiteral("icon")]; + switch(iconProperty.type()){ + case QVariant::Icon: + icon = iconProperty.value<QIcon>(); + break; + case QVariant::Url: + case QVariant::String: { + QString iconSource = iconProperty.toString(); + if (iconSource.startsWith(QLatin1String("qrc:/"))) { + iconSource = iconSource.mid(3); + } else if (iconSource.startsWith(QLatin1String("file:/"))) { + iconSource = QUrl(iconSource).path(); + } + if (iconSource.contains(QLatin1String("/"))) { + icon = QIcon(iconSource); + } else { + icon = m_theme->iconFromTheme(iconSource, m_properties[QStringLiteral("iconColor")].value<QColor>()); + } + } + break; + default: + break; + } + return icon; +} + const char* KQuickStyleItem::classNameForItem() const { switch(m_itemType) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/plugin/kquickstyleitem_p.h new/qqc2-desktop-style-5.76.0/plugin/kquickstyleitem_p.h --- old/qqc2-desktop-style-5.75.0/plugin/kquickstyleitem_p.h 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/plugin/kquickstyleitem_p.h 2020-11-07 12:47:00.000000000 +0100 @@ -256,6 +256,7 @@ bool eventFilter(QObject *watched, QEvent *event) override; private: + QIcon iconFromIconProperty() const; const char* classNameForItem() const; QSize sizeFromContents(int width, int height); qreal baselineOffset(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qqc2-desktop-style-5.75.0/tests/testComboBox.qml new/qqc2-desktop-style-5.76.0/tests/testComboBox.qml --- old/qqc2-desktop-style-5.75.0/tests/testComboBox.qml 2020-10-04 12:00:21.000000000 +0200 +++ new/qqc2-desktop-style-5.76.0/tests/testComboBox.qml 2020-11-07 12:47:00.000000000 +0100 @@ -19,6 +19,13 @@ } } + ComboBox { + Layout.fillWidth: true + textRole: "key" + model: comboModel + editable: true + } + ListView { Layout.fillWidth: true Layout.fillHeight: true _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org