summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorTomi Korpipaa <[email protected]>2025-05-15 12:18:28 +0300
committerSami Varanka <[email protected]>2025-05-23 08:20:20 +0000
commitcb49398dbd9c90d1675634c8fe34a9a1d135bbed (patch)
tree8336a119712223a13c8aafd0e7cf6dd4e104ab51 /tests/manual
parent9b37d41d99ce082b18007352db6842f12b51cd4f (diff)
Allow hiding all or some labels of very small slicesHEADdev
Add properties for controlling the visibility of slice labels in slices that fall under a size limit set by the user. Fixes: QTBUG-135929 Change-Id: I0d88b08bcf66b60f1be01156f1ae723b04507e12 Reviewed-by: Sami Varanka <[email protected]>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/qmltestbed/qml/qmltestbed/PieChart.qml91
1 files changed, 89 insertions, 2 deletions
diff --git a/tests/manual/qmltestbed/qml/qmltestbed/PieChart.qml b/tests/manual/qmltestbed/qml/qmltestbed/PieChart.qml
index adbe8984..ecd38c7f 100644
--- a/tests/manual/qmltestbed/qml/qmltestbed/PieChart.qml
+++ b/tests/manual/qmltestbed/qml/qmltestbed/PieChart.qml
@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
+import QtQuick.Controls.Basic
+import QtQuick.Layouts
import QtGraphs
Item {
@@ -9,17 +11,102 @@ Item {
Text {
id: title
- text: "Simple Pie Graph"
+ text: "(Not So) Simple Pie Graph"
anchors.horizontalCenter: parent.horizontalCenter
color: "#f0f0f0"
y: parent.height * .1
}
+ RowLayout {
+ id: controls
+ anchors.top: title.bottom
+ spacing: 12
+ uniformCellSizes: true
+
+ CheckBox {
+ text: "Show minorities"
+ Layout.fillHeight: true
+
+ onCheckedChanged: {
+ if (checked) {
+ pieSeries.append("Jaguar", 2.0)
+ pieSeries.append("Ferrari", 1.0)
+ pieSeries.append("Lamborghini", 0.5)
+ pieSeries.append("Bugatti", 0.3)
+ pieSeries.append("McLaren", 0.2)
+ pieSeries.append("Koenigsegg", 0.1)
+ for (let i = 6; i < 12; ++i) {
+ pieSeries.at(i).labelVisible = true
+ console.log("Appended: " + pieSeries.at(i).label)
+ }
+ } else {
+ pieSeries.removeMultiple(6, 6)
+ }
+ }
+ }
+
+ Item {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Text {
+ text: "Angle limit (" + angleslider.value + "°):"
+ color: "white"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ }
+ }
+
+ Slider {
+ id: angleslider
+ from: 0
+ to: 20
+ stepSize: 1
+ value: 0
+ Layout.fillHeight: true
+ onValueChanged: pieSeries.angleSpanVisibleLimit = value
+ }
+
+ Item {
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Text {
+ text: "Label visibility mode:"
+ color: "white"
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ }
+ }
+
+ ComboBox {
+ model: [ "None", "First", "EveryOther" ]
+ currentIndex: 1
+ Layout.fillHeight: true
+ onCurrentIndexChanged: {
+ switch (currentIndex) {
+ case 0: {
+ pieSeries.angleSpanVisibleMode = PieSeries.VisibleMode.None
+ break
+ }
+ case 1: {
+ pieSeries.angleSpanVisibleMode = PieSeries.VisibleMode.First
+ break
+ }
+ case 2: {
+ pieSeries.angleSpanVisibleMode = PieSeries.VisibleMode.EveryOther
+ break
+ }
+ }
+ }
+ }
+ }
+
GraphsView {
id: chartView
width: parent.width
height: parent.height
- anchors.top: title.bottom
+ anchors.top: controls.bottom
anchors.bottom: parent.bottom
property variant otherSlice: 0