From fd04fe04c060395533a4ae49ec789a32b3d3ef62 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 27 Jul 2023 10:25:15 -0600 Subject: [PATCH] Port to upstream QML components where possible Basically: - PlasmaExtras.Heading -> Kirigami.Heading - PlasmaComponents3.Label -> QQC2.label We can do this because these components only existed in the past to use special Plasma colors, but no visual styling. And the color stuff is obsolete because Kirigami colors work correctly in Plasma now. Everything was tested with a dark Plasma theme and a light color scheme to ensure no regressions. --- src/plugins/desktopchangeosd/package/contents/ui/osd.qml | 4 ++-- src/plugins/desktopgrid/qml/DesktopView.qml | 6 +++--- src/plugins/outputlocator/qml/OutputLabel.qml | 6 +++--- src/plugins/overview/qml/DesktopBar.qml | 2 +- src/plugins/private/qml/WindowHeapDelegate.qml | 5 +++-- src/plugins/tileseditor/qml/main.qml | 5 +++-- src/qml/frames/plasma/frame_styled.qml | 4 ++-- src/qml/onscreennotification/plasma/main.qml | 4 ++-- src/tabbox/switchers/thumbnail_grid/contents/ui/main.qml | 3 ++- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/plugins/desktopchangeosd/package/contents/ui/osd.qml b/src/plugins/desktopchangeosd/package/contents/ui/osd.qml index 0e9cab3f6e..fb49ca64b0 100644 --- a/src/plugins/desktopchangeosd/package/contents/ui/osd.qml +++ b/src/plugins/desktopchangeosd/package/contents/ui/osd.qml @@ -10,7 +10,7 @@ import QtQuick import QtQuick.Window import org.kde.plasma.core as PlasmaCore import org.kde.ksvg 1.0 as KSvg -import org.kde.plasma.extras as PlasmaExtras +import org.kde.kirigami 2.20 as Kirigami import org.kde.kwin PlasmaCore.Dialog { @@ -66,7 +66,7 @@ PlasmaCore.Dialog { width: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth) height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height - PlasmaExtras.Heading { + Kirigami.Heading { id: textElement anchors.top: dialogItem.showGrid ? parent.top : undefined anchors.left: parent.left diff --git a/src/plugins/desktopgrid/qml/DesktopView.qml b/src/plugins/desktopgrid/qml/DesktopView.qml index 5cc1cd10f8..1dc5e992c1 100644 --- a/src/plugins/desktopgrid/qml/DesktopView.qml +++ b/src/plugins/desktopgrid/qml/DesktopView.qml @@ -7,10 +7,10 @@ */ import QtQuick +import QtQuick.Controls as QQC2 import org.kde.kwin as KWinComponents import org.kde.kwin.private.effects import org.kde.kirigami 2.20 as Kirigami -import org.kde.plasma.components 3.0 as PC3 import org.kde.kwin.private.desktopgrid FocusScope { @@ -173,7 +173,7 @@ FocusScope { cursorShape: dragHandler.active ? Qt.ClosedHandCursor : Qt.ArrowCursor } - PC3.Control { + QQC2.Control { id: desktopLabel anchors.margins: Kirigami.Units.gridUnit z: 9999 @@ -293,7 +293,7 @@ FocusScope { scale: 1 / desktopView.parent.scale leftPadding: Kirigami.Units.smallSpacing rightPadding: Kirigami.Units.smallSpacing - contentItem: PC3.Label { + contentItem: QQC2.Label { text: desktopView.desktop.name } background: Rectangle { diff --git a/src/plugins/outputlocator/qml/OutputLabel.qml b/src/plugins/outputlocator/qml/OutputLabel.qml index 0cf43c4448..af6bd30017 100644 --- a/src/plugins/outputlocator/qml/OutputLabel.qml +++ b/src/plugins/outputlocator/qml/OutputLabel.qml @@ -5,7 +5,7 @@ */ import QtQuick -import org.kde.plasma.components 3.0 as PlasmaComponents3 +import QtQuick.Controls as QQC2 import org.kde.kirigami 2 as Kirigami Rectangle { @@ -20,7 +20,7 @@ Rectangle { implicitWidth: childrenRect.width + 2 * childrenRect.x implicitHeight: childrenRect.height + 2 * childrenRect.y - PlasmaComponents3.Label { + QQC2.Label { id: displayName x: Kirigami.Units.largeSpacing * 2 y: Kirigami.Units.largeSpacing @@ -30,7 +30,7 @@ Rectangle { horizontalAlignment: Text.AlignHCenter; } - PlasmaComponents3.Label { + QQC2.Label { id: modeLabel; anchors { horizontalCenter: displayName.horizontalCenter diff --git a/src/plugins/overview/qml/DesktopBar.qml b/src/plugins/overview/qml/DesktopBar.qml index 6af470f60e..f4c63f9862 100644 --- a/src/plugins/overview/qml/DesktopBar.qml +++ b/src/plugins/overview/qml/DesktopBar.qml @@ -194,7 +194,7 @@ Item { height: Kirigami.Units.gridUnit state: "normal" - PC3.Label { + Label { anchors.fill: parent elide: Text.ElideRight text: delegate.desktop.name diff --git a/src/plugins/private/qml/WindowHeapDelegate.qml b/src/plugins/private/qml/WindowHeapDelegate.qml index 74c405a147..2dc9a24936 100644 --- a/src/plugins/private/qml/WindowHeapDelegate.qml +++ b/src/plugins/private/qml/WindowHeapDelegate.qml @@ -6,6 +6,7 @@ */ import QtQuick +import QtQuick.Controls as QQC2 import QtQuick.Window import org.kde.kirigami 2.20 as Kirigami import org.kde.kwin as KWinComponents @@ -146,7 +147,7 @@ Item { } } - PC3.Label { + QQC2.Label { anchors.fill: thumbSource horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter @@ -166,7 +167,7 @@ Item { anchors.bottomMargin: -Math.round(height / 4) visible: !thumb.activeHidden && !activeDragHandler.active - PC3.Label { + QQC2.Label { id: caption visible: thumb.windowTitleVisible width: Math.min(implicitWidth, thumbSource.width) diff --git a/src/plugins/tileseditor/qml/main.qml b/src/plugins/tileseditor/qml/main.qml index c7b28e3768..18e85c094d 100644 --- a/src/plugins/tileseditor/qml/main.qml +++ b/src/plugins/tileseditor/qml/main.qml @@ -5,6 +5,7 @@ */ import QtQuick +import QtQuick.Controls as QQC2 import Qt5Compat.GraphicalEffects import QtQuick.Layouts import org.kde.kwin as KWinComponents @@ -125,7 +126,7 @@ FocusScope { } } - PlasmaComponents.Control { + QQC2.Control { z: 2 anchors.right: parent.right y: root.active ? 0 : -height @@ -147,7 +148,7 @@ FocusScope { } } contentItem: RowLayout { - PlasmaComponents.Label { + QQC2.Label { text: i18nd("kwin","Padding:") } PlasmaComponents.SpinBox { diff --git a/src/qml/frames/plasma/frame_styled.qml b/src/qml/frames/plasma/frame_styled.qml index e184ae4c1d..6cdfd2d4e1 100644 --- a/src/qml/frames/plasma/frame_styled.qml +++ b/src/qml/frames/plasma/frame_styled.qml @@ -6,12 +6,12 @@ */ import QtQuick +import QtQuick.Controls as QQC2 import QtQuick.Layouts import org.kde.plasma.core as PlasmaCore import org.kde.kirigami 2.20 as Kirigami import org.kde.ksvg 1.0 as KSvg -import org.kde.plasma.components 3.0 as PlasmaComponents Item { id: root @@ -49,7 +49,7 @@ Item { source: root.effectFrame.icon } - PlasmaComponents.Label { + QQC2.Label { id: label Layout.fillWidth: true textFormat: Text.PlainText diff --git a/src/qml/onscreennotification/plasma/main.qml b/src/qml/onscreennotification/plasma/main.qml index b3578d48aa..cd5193a2e2 100644 --- a/src/qml/onscreennotification/plasma/main.qml +++ b/src/qml/onscreennotification/plasma/main.qml @@ -6,12 +6,12 @@ */ import QtQuick +import QtQuick.Controls as QQC2 import QtQuick.Layouts import QtQuick.Window import org.kde.plasma.core as PlasmaCore import org.kde.kirigami 2.20 as Kirigami -import org.kde.plasma.components 3.0 as PlasmaComponents3 PlasmaCore.Dialog { location: PlasmaCore.Types.Floating @@ -28,7 +28,7 @@ PlasmaCore.Dialog { source: osd.iconName visible: osd.iconName !== "" } - PlasmaComponents3.Label { + QQC2.Label { text: osd.message } } diff --git a/src/tabbox/switchers/thumbnail_grid/contents/ui/main.qml b/src/tabbox/switchers/thumbnail_grid/contents/ui/main.qml index a1927124dc..5cf4a10071 100644 --- a/src/tabbox/switchers/thumbnail_grid/contents/ui/main.qml +++ b/src/tabbox/switchers/thumbnail_grid/contents/ui/main.qml @@ -9,6 +9,7 @@ */ import QtQuick 2.0 +import QtQuick.Controls as QQC2 import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.ksvg 1.0 as KSvg @@ -185,7 +186,7 @@ KWin.TabBoxSwitcher { } } - PlasmaComponents3.Label { + QQC2.Label { Layout.fillWidth: true text: model.caption font.weight: thumbnailGridItem.isCurrentItem ? Font.Bold : Font.Normal