cfg: slider for pollingrate

This commit is contained in:
Flummi 2024-01-19 02:57:59 +01:00
parent 4cea131ed0
commit 026f9b740a
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817
2 changed files with 31 additions and 11 deletions

View File

@ -4,12 +4,12 @@
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name=""/> <kcfgfile name=""/>
<group name="General"> <group name="General">
<entry name="pollingrate" type="Int"> <entry name="pollingrate" type="Int">
<default>10</default> <default>10.0</default>
<min>2</min> <min>2.0</min>
<max>60</max> <max>60.0</max>
</entry> </entry>
</group> </group>
</kcfg> </kcfg>

View File

@ -1,5 +1,7 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5 as QQC2 import QtQuick.Controls 2.5 as QQC2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.4 as Kirigami import org.kde.kirigami 2.4 as Kirigami
QQC2.Pane { QQC2.Pane {
@ -11,14 +13,32 @@ QQC2.Pane {
anchors.fill: parent anchors.fill: parent
wideMode: false wideMode: false
QQC2.SpinBox { GridLayout {
id: pollingrate columns: 3
Kirigami.FormData.label: i18nc("@label", "pollingrate in seconds:")
onValueChanged: { Text {
console.log("cfg_pollingrate: " + cfg_pollingrate); text: "polling rate:"
color: PlasmaCore.Theme.textColor
}
QQC2.Slider {
id: pollingrate
value: 10.0
from: 2.0
to: 60.0
stepSize: 2.0
snapMode: Slider.SnapAlways
Kirigami.FormData.label: i18nc("@label", "polling rate in seconds:")
onMoved: {
test.text = this.value + " seconds";
}
}
Text {
id: test
text: pollingrate.value + " seconds"
color: PlasmaCore.Theme.textColor
} }
from: 2
to: 60
} }
} }
} }