plugins/desktopchangeosd: Port to simpler PlasmaWindow

Plasma::Dialog contains logic that we don't want for a kwin window and
is considered deprecated. Dialog uses the width of the main item which
results in an unavoidable binding loop.

PlasmaWindow allows us to propagate implicit sizes upwards correctly.

BUG: 420757
This commit is contained in:
David Edmundson 2024-04-11 14:49:33 +01:00
parent 572e07b130
commit 5362105f27

View file

@ -13,12 +13,13 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.ksvg 1.0 as KSvg
import org.kde.kwin
PlasmaCore.Dialog {
PlasmaCore.Window {
id: dialog
location: PlasmaCore.Types.Floating
visible: false
flags: Qt.X11BypassWindowManagerHint | Qt.FramelessWindowHint
outputOnly: true
width: mainItem.implicitWidth + leftPadding + rightPadding
height: mainItem.implicitHeight + topPadding + bottomPadding
mainItem: Item {
function loadConfig() {
@ -38,8 +39,8 @@ PlasmaCore.Dialog {
property int animationDuration: 1000
property bool showGrid: true
width: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth)
height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height
implicitWidth: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth)
implicitHeight: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.implicitHeight : textElement.implicitHeight
Kirigami.Heading {
id: textElement