on xenial help sign in
use __internals is a bit less bad than using __styleInstance
34f820dAlbert Astals Cid
qml/Dash/Filters/FilterValueSlider.qml+3−5
@@ -43,14 +43,12 @@ FilterWidget {
43 widgetData.value = value;
43 widgetData.value = value;
44 }
44 }
45
45
46− // TODO SDK
47− readonly property Item bar: __styleInstance ? __styleInstance.bar : null
48− readonly property Item thumb: __styleInstance ? __styleInstance.thumb : null
46+ readonly property Item thumb: __internals.thumb
49− readonly property real thumbSpacing: __styleInstance ? __styleInstance.thumbSpacing : 0
47+ readonly property real barMinusThumb: __internals.barMinusThumb
50− readonly property real barMinusThumb: bar && thumb ? bar.width - (thumb.width + 2.0*thumbSpacing) : 0.0
51 }
48 }
52
49
53 Repeater {
50 Repeater {
51+ objectName: "repeater"
54 model: widgetData.values
52 model: widgetData.values
55 delegate: Label {
53 delegate: Label {
56 anchors {
54 anchors {
tests/qmltests/Dash/Filters/tst_FilterValueSlider.qml+19
@@ -78,5 +78,24 @@ Rectangle {
78 slider.value = 50
78 slider.value = 50
79 compare(widgetData1.value, 50);
79 compare(widgetData1.value, 50);
80 }
80 }
81+
82+ function test_labelPositions() {
83+ var slider = findChild(factory, "slider");
84+ var repeater = findChild(factory, "repeater");
85+
86+ // It's very hard to check the position of the
87+ // labels is right, but at least we can check
88+ // they all have different X positions and the
89+ // same Y one
90+ compare(repeater.count, 4);
91+ for (var i = 0; i < repeater.count; ++i) {
92+ var itemI = repeater.itemAt(i);
93+ for (var j = i + 1; j < repeater.count; ++j) {
94+ var itemJ = repeater.itemAt(j);
95+ verify(itemI.x != itemJ.x);
96+ verify(itemI.y == itemJ.y);
97+ }
98+ }
99+ }
81 }
100 }
82}
101}