[plasma/kinfocenter] kcms/about-distro/src/ui: Port to new Kirigami.Form API

Noah Davis <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5bd87de7981ee5924f248e0a1ae245d871355319 by Noah Davis.
Committed on 30/07/2026 at 15:53.
Pushed by ndavis into branch 'master'.

Port to new Kirigami.Form API

Related to https://invent.kde.org/plasma/systemsettings/-/work_items/50

M  +77   -81   kcms/about-distro/src/ui/main.qml

https://invent.kde.org/plasma/kinfocenter/-/commit/5bd87de7981ee5924f248e0a1ae245d871355319

diff --git a/kcms/about-distro/src/ui/main.qml b/kcms/about-distro/src/ui/main.qml
index 7f2b4da1..8f84cca0 100644
--- a/kcms/about-distro/src/ui/main.qml
+++ b/kcms/about-distro/src/ui/main.qml
@@ -73,108 +73,104 @@ KCMUtils.SimpleKCM {
             }
         }
 
-        Kirigami.FormLayout {
+        Kirigami.Form {
             Layout.fillHeight: true
+            Layout.fillWidth: true
+            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
 
             Component {
                 id: entryComponent
-                RowLayout {
-                    Kirigami.FormData.label: entry.localizedLabel()
-                    Kirigami.FormData.labelAlignment: idealAlignment
-                    Layout.alignment: idealAlignment
-
-                    readonly property int idealAlignment: valueLabel.lineCount > 1 ? Qt.AlignTop : Qt.AlignVCenter // looks tidier this way
-                    readonly property bool hidden: entry.isHidden()
-
-                    spacing: Kirigami.Units.smallSpacing
-
-                    Component {
-                        id: unhideDialog
-                        Kirigami.PromptDialog {
-                            // NB: should we ever have other entries that need this dialog then this needs refactoring on the Entry side.
-                            //  Do NOT simply add if else logic here!
-                            title: i18nc("@title", "Serial Number")
-                            subtitle: entry.localizedValue()
-                            flatFooterButtons: true
-                            standardButtons: Kirigami.Dialog.NoButton
-                            customFooterActions: [
-                                Kirigami.Action {
-                                    text: i18nc("@action:button", "Copy")
-                                    icon.name: "edit-copy-symbolic"
-                                    onTriggered: source => kcm.storeInClipboard(subtitle)
-                                    shortcut: StandardKey.Copy
-                                }
-                            ]
-                            onClosed: destroy();
+                Kirigami.FormEntry {
+                    id: entryItem
+                    Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
+                    Layout.fillWidth: true
+                    title: entry.localizedLabel()
+                    contentItem: RowLayout {
+                        spacing: Kirigami.Units.smallSpacing
+                        Component {
+                            id: unhideDialog
+                            Kirigami.PromptDialog {
+                                // NB: should we ever have other entries that need this dialog then this needs refactoring on the Entry side.
+                                //  Do NOT simply add if else logic here!
+                                title: i18nc("@title", "Serial Number")
+                                subtitle: entry.localizedValue()
+                                flatFooterButtons: true
+                                standardButtons: Kirigami.Dialog.NoButton
+                                customFooterActions: [
+                                    Kirigami.Action {
+                                        text: i18nc("@action:button", "Copy")
+                                        icon.name: "edit-copy-symbolic"
+                                        onTriggered: source => kcm.storeInClipboard(subtitle)
+                                        shortcut: StandardKey.Copy
+                                    }
+                                ]
+                                onClosed: destroy();
+                            }
                         }
-                    }
 
-                    Kirigami.SelectableLabel {
-                        id: valueLabel
-                        visible: !hidden
-                        text: entry.localizedValue()
-                        Keys.onShortcutOverride: event => {
-                            event.accepted = (valueLabel.activeFocus && valueLabel.selectedText && event.matches(StandardKey.Copy));
-                        }
-                        Keys.onPressed: event => {
-                            if (event.matches(StandardKey.Copy)) {
-                                valueLabel.copy();
-                                event.accepted = true;
+                        Kirigami.SelectableLabel {
+                            id: valueLabel
+                            visible: !entry.isHidden()
+                            text: entry.localizedValue()
+                            Keys.onShortcutOverride: event => {
+                                event.accepted = (valueLabel.activeFocus && valueLabel.selectedText && event.matches(StandardKey.Copy));
+                            }
+                            Keys.onPressed: event => {
+                                if (event.matches(StandardKey.Copy)) {
+                                    valueLabel.copy();
+                                    event.accepted = true;
+                                }
                             }
                         }
-                    }
 
-                    Kirigami.Badge {
-                        visible: text.length > 0
-                        padding: 1
-                        customColor: {
-                            switch (entry.localizedHint().color) {
-                                case Private.hint.Color.One: return Kirigami.Theme.activeBackgroundColor
-                                case Private.hint.Color.Two: return Kirigami.Theme.positiveBackgroundColor
-                                case Private.hint.Color.Three: return Kirigami.Theme.alternateBackgroundColor
+                        Kirigami.Badge {
+                            visible: text.length > 0
+                            padding: 1
+                            customColor: {
+                                switch (entry.localizedHint().color) {
+                                    case Private.hint.Color.One: return Kirigami.Theme.activeBackgroundColor
+                                    case Private.hint.Color.Two: return Kirigami.Theme.positiveBackgroundColor
+                                    case Private.hint.Color.Three: return Kirigami.Theme.alternateBackgroundColor
+                                }
                             }
+                            text: entry.localizedHint().text
                         }
-                        text: entry.localizedHint().text
-                    }
 
-                    Kirigami.ContextualHelpButton {
-                        visible: toolTipText.length > 0
-                        toolTipText: entry.localizedHelp()
-                    }
+                        Kirigami.ContextualHelpButton {
+                            visible: toolTipText.length > 0
+                            toolTipText: entry.localizedHelp()
+                        }
 
-                    QQC2.Button {
-                        visible: hidden
-                        property var dialog: null
-                        icon.name: "view-visible-symbolic"
-                        text: i18nc("@action:button show a hidden entry in an overlay", "Show")
-                        onClicked: {
-                            if (!dialog) {
-                                dialog = unhideDialog.createObject(root, {});
+                        QQC2.Button {
+                            visible: entry.isHidden()
+                            property var dialog: null
+                            icon.name: "view-visible-symbolic"
+                            text: i18nc("@action:button show a hidden entry in an overlay", "Show")
+                            onClicked: {
+                                if (!dialog) {
+                                    dialog = unhideDialog.createObject(root, {});
+                                }
+                                dialog.open();
                             }
-                            dialog.open();
                         }
                     }
                 }
             }
 
-            Item {
-                Kirigami.FormData.label: i18nc("@title:group", "Software")
-                Kirigami.FormData.isSection: true
-            }
-
-            Repeater {
-                model: kcm.softwareEntries
-                delegate: entryComponent
-            }
-
-            Item {
-                Kirigami.FormData.label: i18nc("@title:group", "Hardware")
-                Kirigami.FormData.isSection: true
+            Kirigami.FormGroup {
+                title: i18nc("@title:group", "Software")
+                Repeater {
+                    model: kcm.softwareEntries
+                    delegate: entryComponent
+                }
             }
 
-            Repeater {
-                model: kcm.hardwareEntries
-                delegate: entryComponent
+            Kirigami.FormGroup {
+                title: i18nc("@title:group", "Hardware")
+                Repeater {
+                    model: kcm.hardwareEntries
+                    delegate: entryComponent
+                }
             }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.