This commit is contained in:
2026-02-23 22:34:50 +00:00
commit 603d5b51bd
19 changed files with 1381 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import QtQuick
import org.kde.plasma.configuration
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "configure"
source: "configGeneral.qml"
}
}
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name=""/>
<group name="General">
<entry name="userText" type="String">
<label>Text to display</label>
<default>Hello KDE 6!</default>
</entry>
<entry name="showSeconds" type="Bool">
<label>Show seconds</label>
<default>false</default>
</entry>
</group>
</kcfg>
+28
View File
@@ -0,0 +1,28 @@
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kcmutils as KCM
import org.kde.kirigami as Kirigami
KCM.SimpleKCM {
property alias cfg_userText: userTextField.text
property alias cfg_showSeconds: showSecondsCheckBox.checked
Kirigami.FormLayout {
QQC2.TextField {
id: userTextField
Kirigami.FormData.label: i18n("Display Text:")
placeholderText: i18n("Enter text here")
}
QQC2.CheckBox {
id: showSecondsCheckBox
Kirigami.FormData.label: i18n("Options:")
text: i18n("Show Seconds")
}
}
}
+90
View File
@@ -0,0 +1,90 @@
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import "cppbridge" as CppBridge
import org.kde.kirigami as Kirigami
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.plasmoid
PlasmoidItem {
id: root
// Properties accessed from configuration.
// "qmllint" sees `plasmoid` as QObject here, but Plasma injects `configuration` at runtime.
// qmllint disable missing-property
property bool showSeconds: plasmoid.configuration.showSeconds
// qmllint disable missing-property
property string userText: plasmoid.configuration.userText
property string cppTimeText: "Click the button to request time from C++."
// Widget Setup
width: Kirigami.Units.gridUnit * 20
height: Kirigami.Units.gridUnit * 20
toolTipMainText: "Plasma 6 Starter"
toolTipSubText: "Click to open full view"
CppBridge.TimeBridge {
id: timeBridge
}
// Define the full representation (popup or desktop widget)
fullRepresentation: Item {
Layout.minimumWidth: Kirigami.Units.gridUnit * 10
Layout.minimumHeight: Kirigami.Units.gridUnit * 10
Layout.preferredWidth: root.width
Layout.preferredHeight: root.height
ColumnLayout {
anchors.fill: parent
anchors.margins: Kirigami.Units.largeSpacing
spacing: Kirigami.Units.largeSpacing
PlasmaComponents.Label {
text: root.userText
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5
Layout.alignment: Qt.AlignHCenter
}
PlasmaComponents.Label {
text: "Welcome to 6!"
Layout.alignment: Qt.AlignHCenter
opacity: 0.7
}
PlasmaComponents.Label {
text: root.cppTimeText
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
Item {
Layout.fillHeight: true
}
PlasmaComponents.Button {
text: "Get from C++"
Layout.alignment: Qt.AlignHCenter
onClicked: root.cppTimeText = timeBridge.currentTimeString(root.showSeconds)
}
}
}
// Define the compact representation (icon in panel)
compactRepresentation: Item {
Kirigami.Icon {
anchors.fill: parent
source: "plasma"
MouseArea {
anchors.fill: parent
onClicked: root.expanded = !root.expanded
}
}
}
}