summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-11-04 11:26:56 +0100
committerJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>2015-11-04 12:59:30 +0000
commita68b58a35aeafad279236d31c28acda02baff5cf (patch)
tree46cb8071b5fb84cbcaea5f7578004267e7a7fb09
parentb2492f31fd55b7b7335154464c1c12a6895f5a23 (diff)
downloadqtquickcontrols-a68b58a35aeafad279236d31c28acda02baff5cf.tar.gz
Fix CircularGauge's tickmark labels all being set 0
We were relying on model.get() to somehow reevaluate after we'd updated properties of model items, which somehow worked until 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e. The correct approach is to do the same thing as we do for styleData.index: rely on the model properties that are exposed to the delegate, which do get updated. Change-Id: I529ab7dcc142187fc185b11658dc5e1496b6d6db Task-number: QTBUG-48839 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/Styles/Base/CircularTickmarkLabelStyle.qml4
-rw-r--r--tests/auto/extras/data/tst_circulartickmarklabel.qml9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml
index 010e9245..6e1c6740 100644
--- a/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml
+++ b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml
@@ -285,6 +285,7 @@ Style {
}
delegate: Loader {
id: tickmarkLabelDelegateLoader
+ objectName: "labelDelegateLoader" + index
sourceComponent: tickmarkLabel
x: pos.x
y: pos.y
@@ -292,8 +293,9 @@ Style {
readonly property point pos: panelItem.labelPosFromIndex(index, width, height);
readonly property int __index: index
+ readonly property real __value: value
property QtObject styleData: QtObject {
- readonly property var value: index != -1 ? labelItemRepeater.model.get(index).value : 0
+ readonly property var value: index != -1 ? tickmarkLabelDelegateLoader.__value : 0
readonly property alias index: tickmarkLabelDelegateLoader.__index
}
}
diff --git a/tests/auto/extras/data/tst_circulartickmarklabel.qml b/tests/auto/extras/data/tst_circulartickmarklabel.qml
index 2d1841e0..60d7ff9e 100644
--- a/tests/auto/extras/data/tst_circulartickmarklabel.qml
+++ b/tests/auto/extras/data/tst_circulartickmarklabel.qml
@@ -314,6 +314,15 @@ TestCase {
compare(label.__panel.tickmarkValueFromMinorIndex(((label.tickmarkCount - 1) * label.minorTickmarkCount) - 1), 98);
}
+ function test_labelText() {
+ for (var i = 0; i < label.labelCount; ++i) {
+ var labelDelegateLoader = findChild(label, "labelDelegateLoader" + i);
+ verify(labelDelegateLoader);
+ compare(labelDelegateLoader.styleData.index, i);
+ compare(labelDelegateLoader.styleData.value, i * label.labelStepSize);
+ }
+ }
+
function test_invalidValues() {
// Shouldn't produce warnings.
label.labelStepSize = 0;