2020-08-20 00:14:19 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2014 David Edmundson <kde@davidedmundson.co.uk>
|
|
|
|
* SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
|
|
|
|
* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2014-09-26 17:37:53 +02:00
|
|
|
import QtQuick 2.0
|
2020-08-18 11:45:23 +02:00
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2014-09-26 17:37:53 +02:00
|
|
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
|
|
|
|
2019-12-09 17:33:23 +01:00
|
|
|
ComponentBase {
|
2014-09-26 17:37:53 +02:00
|
|
|
id: root
|
2020-08-18 11:45:23 +02:00
|
|
|
title: "Plasma Components 2 ProgressBar"
|
2014-11-10 22:09:55 +01:00
|
|
|
property int orientation: orientationCombo.model[orientationCombo.currentIndex].value
|
2020-08-18 11:45:23 +02:00
|
|
|
property int progressBarWidth: testProgressBar.width
|
|
|
|
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
id: testProgressBar
|
|
|
|
visible: false
|
|
|
|
}
|
2014-11-10 22:09:55 +01:00
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
contentItem: GridLayout {
|
|
|
|
columns: 6
|
|
|
|
columnSpacing: PlasmaCore.Units.largeSpacing
|
|
|
|
rowSpacing: PlasmaCore.Units.largeSpacing
|
2014-09-26 17:37:53 +02:00
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
2014-09-26 17:37:53 +02:00
|
|
|
text: "0%"
|
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 0
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
2014-09-26 17:37:53 +02:00
|
|
|
text: "50%"
|
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 50
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
2014-09-26 17:37:53 +02:00
|
|
|
text: "100%"
|
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 100
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
id: progressBarAndSliderLabel
|
|
|
|
text: "The progress bar and slider grooves should have the same visual width."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
|
|
|
}
|
|
|
|
GridLayout {
|
|
|
|
id: progressBarAndSliderGrid
|
|
|
|
columns: orientation === Qt.Vertical ? 2 : 1
|
|
|
|
rows: orientation === Qt.Vertical ? 1 : 2
|
2014-11-10 22:09:55 +01:00
|
|
|
PlasmaComponents.ProgressBar {
|
2020-08-18 11:45:23 +02:00
|
|
|
id: progressBar
|
2014-11-10 22:09:55 +01:00
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 50
|
|
|
|
orientation: root.orientation
|
|
|
|
}
|
|
|
|
PlasmaComponents.Slider {
|
2020-08-18 11:45:23 +02:00
|
|
|
width: progressBar.width
|
|
|
|
height: progressBar.height
|
2014-11-10 22:09:55 +01:00
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 50
|
|
|
|
orientation: root.orientation
|
|
|
|
}
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Min: 0; Max: 200; Value: 1\nMake sure the bar does not leak outside."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-11-10 22:13:41 +01:00
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 200
|
|
|
|
value: 1
|
|
|
|
orientation: root.orientation
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Min: 0; Max: 100; Value: 110\nThe progress bar should look like it is at 100%."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: 110
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Min: -100; Max: 100; Value: 0\nThe progress bar should look like it is at 50%."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: -100
|
|
|
|
maximumValue: 100
|
|
|
|
value: 0
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Min: 0; Max: 100; Value: -10\nThe progress bar should look like it is at 0%."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
minimumValue: 0
|
|
|
|
maximumValue: 100
|
|
|
|
value: -10
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "This should have a continuous movement from one end to the other and back."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-10-04 22:40:27 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.ProgressBar {
|
|
|
|
indeterminate: indeterminateCheckBox.checked
|
|
|
|
value: 0.5
|
2014-11-10 22:09:55 +01:00
|
|
|
orientation: root.orientation
|
2014-10-04 22:40:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
text: "Checking and unchecking should not break the layout. The progress bar should look like it is at 50% if unchecked."
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.preferredWidth: progressBarWidth
|
2014-10-04 22:40:27 +02:00
|
|
|
}
|
|
|
|
PlasmaComponents.CheckBox {
|
|
|
|
id: indeterminateCheckBox
|
|
|
|
text: "Indeterminate"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
}
|
2014-09-26 17:37:53 +02:00
|
|
|
|
2020-08-18 11:45:23 +02:00
|
|
|
ColumnLayout {
|
|
|
|
PlasmaComponents.Label {
|
2014-11-10 22:09:55 +01:00
|
|
|
text: "Slider orientation"
|
|
|
|
}
|
|
|
|
PlasmaComponents.ComboBox {
|
|
|
|
id: orientationCombo
|
|
|
|
model: [
|
|
|
|
{text: "Horizontal", value: Qt.Horizontal},
|
|
|
|
{text: "Vertical", value: Qt.Vertical}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2014-09-26 17:37:53 +02:00
|
|
|
}
|
2014-10-04 22:40:27 +02:00
|
|
|
}
|