on xenial help sign in
use __internals is a bit less bad than using __styleInstance
commit34f820d469187ef701d265fd580aa1a8b8b67975 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 25 Nov 2015, 15:42 (11 years ago) parentbbccae6
2 files changed+22−5
qml/Dash/Filters/FilterValueSlider.qml+3−5 tests/qmltests/Dash/Filters/tst_FilterValueSlider.qml+19
qml/Dash/Filters/FilterValueSlider.qml+3−5
@@ -43,14 +43,12 @@ FilterWidget {
4343 widgetData.value = value;
4444 }
4545
46− // TODO SDK
47− readonly property Item bar: __styleInstance ? __styleInstance.bar : null
48− readonly property Item thumb: __styleInstance ? __styleInstance.thumb : null
49− readonly property real thumbSpacing: __styleInstance ? __styleInstance.thumbSpacing : 0
50− readonly property real barMinusThumb: bar && thumb ? bar.width - (thumb.width + 2.0*thumbSpacing) : 0.0
46+ readonly property Item thumb: __internals.thumb
47+ readonly property real barMinusThumb: __internals.barMinusThumb
5148 }
5249
5350 Repeater {
51+ objectName: "repeater"
5452 model: widgetData.values
5553 delegate: Label {
5654 anchors {
tests/qmltests/Dash/Filters/tst_FilterValueSlider.qml+19
@@ -78,5 +78,24 @@ Rectangle {
7878 slider.value = 50
7979 compare(widgetData1.value, 50);
8080 }
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+ }
81100 }
82101}