I have a plasmoid written for kde 5.0 and now it doesn’t work under kde 6.0. please help me convert it to plasmoid version 6.0. I have tried my best debugging using plasmawindowed
and plasmoidviewer
:
config.qml:
import QtQuick 2.15
import org.kde.plasma.configuration 2.1
ConfigModel {
ConfigCategory {
name: "General"
icon: "go-home"
source: "config/general.qml"
}
}
general.qml
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.plasma.plasmoid 2.1
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 3.1 as PlasmaComponents
Item {
property alias cfg_widgetWidth: widgetWidth.value
property alias cfg_showTooltip: showTooltip.checked
property alias cfg_updateInterval: updateInterval.value
property alias cfg_mainText: mainText.text
property alias cfg_tooltipText: tooltipText.text
anchors.centerIn: parent
ColumnLayout {
RowLayout {
Label { text: "Widget width" }
SpinBox {
id: widgetWidth
from: 10
to: 10000
stepSize: 10
suffix: ""
}
}
RowLayout {
CheckBox {
id: showTooltip
text: "Show tooltip"
}
}
RowLayout {
Label { text: "Update Interval (seconds)" }
SpinBox {
id: updateInterval
from: 0.001
to: 86399
stepSize: 1
suffix: " s"
}
}
RowLayout {
Label { text: "Main" }
TextField {
id: mainText
Layout.fillWidth: true
placeholderText: "HTML & CSS are supported"
text: ""
}
}
RowLayout {
Label { text: "Tooltip" }
TextField {
id: tooltipText
Layout.fillWidth: true
placeholderText: "HTML & CSS are supported"
text: ""
}
}
}
}
main.qml
import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.plasmoid 2.1
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 3.1 as PlasmaComponents
import "../lib/pdp.js" as Parser
Item {
id: root
property bool showTooltip: plasmoid.configuration.showTooltip
property int updateInterval: plasmoid.configuration.updateInterval * 1000
property int widgetWidth: plasmoid.configuration.widgetWidth
property string mainText: plasmoid.configuration.mainText
property string tooltipText: plasmoid.configuration.tooltipText
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Layout.preferredHeight: persianDateLabel.height + 8
Layout.preferredWidth: widgetWidth
Layout.maximumHeight: persianDateLabel.height + 8
Layout.maximumWidth: widgetWidth
anchors.left: parent.left
FontLoader {
source: "../fonts/Vazir.ttf"
}
PlasmaCore.DataSource {
id: localTime
engine: "time"
connectedSources: ["Local"]
interval: updateInterval
}
PlasmaComponents.Label {
id: persianDateLabel
smooth: true
font.family: "Vazir"
font.pointSize: -1
font.pixelSize: parent.height * 0.6
textFormat: Text.RichText
text: Parser.parse(mainText, localTime.data.Local.DateTime, true)
wrapMode: Text.NoWrap
anchors.centerIn: parent
}
PlasmaCore.ToolTipArea {
anchors.fill: parent
visible: showTooltip
textFormat: Text.RichText
mainText: ""
subText: Parser.parse(tooltipText, localTime.data.Local.DateTime, true)
}
}
I have used ChatGPT
but the answer doesn’t work.
I tried ChatGPT
but it didn’t work. Manual debugging didn’t work as well.
New contributor
Masoud Yousefvand is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.