66
\qmlproperty Flickable Scrollbar::flickableItem
66
67
This property holds the flickable item (Flickable, ListView or GridView)
67
68
the Scrollbar is attached to.
69
70
property Flickable flickableItem: null
73
This property holds the other scrollbar that is attached to the same flickable,
74
if any. For instance, if this scrollbar is horizontal, buddyScrollbar must be set
75
to the vertical scrollbar, if any. This is to allow a correct layout of both
76
horizontal and vertical scrollbars when a view is scrollable in both directions.
78
//can't use property Scrollbar here as it would complain "Scrollbar instantiated recursively"
79
property var __buddyScrollbar: null
82
\qmlproperty int Scrollbar::align
72
83
The property defines the alignment of the scrollbar to the flickableItem.
73
84
The implementation handles the alignment as follows:
89
100
property bool __interactive: __styleInstance !== null && __styleInstance.interactive
91
implicitWidth: internals.vertical ? units.gu(4) : flickableItem.width
92
implicitHeight: !internals.vertical ? units.gu(4) : flickableItem.height
105
This trough of the scrollbar, it is used to define the position of the slider.
107
property Item __trough: __styleInstance !== null && __styleInstance.trough
112
simulate the system setting (which will be implemented in unity8, I guess)
113
True --> Steppers style, non-overlay scrollbars
114
False --> Indicator and Trough styles
116
property bool __alwaysOnScrollbars: false
119
Used by ScrollView to tweak Scrollbar's anchoring logic for the always-on scrollbars.
121
property Item __viewport: null
123
//Disable the input handling to let the events pass through in case we have an
124
//interactive scrollbar right below us (can happen with nested views)
125
enabled: __interactive//&& __alwaysOnScrollbars
127
implicitWidth: internals.vertical ? units.gu(3) : flickableItem.width
128
implicitHeight: !internals.vertical ? units.gu(3) : flickableItem.height
95
left: internals.leftAnchor(flickableItem)
96
right: internals.rightAnchor(flickableItem)
97
top: internals.topAnchor(flickableItem)
98
bottom: internals.bottomAnchor(flickableItem)
131
left: internals.leftAnchor(__viewport ? __viewport : flickableItem)
132
leftMargin: internals.leftAnchorMargin()
133
right: internals.rightAnchor(__viewport ? __viewport : flickableItem)
134
rightMargin: internals.rightAnchorMargin()
135
top: internals.topAnchor(__viewport ? __viewport : flickableItem)
136
topMargin: internals.topAnchorMargin()
137
bottom: internals.bottomAnchor(__viewport ? __viewport : flickableItem)
138
bottomMargin: internals.bottomAnchorMargin()
122
163
// LTR and RTL are provided by LayoutMirroring, so no need to check that
123
164
function leftAnchor(object)
125
if (!internals.vertical || (align == Qt.AlignLeading))
166
if (!internals.vertical || (align == Qt.AlignLeading)) {
126
167
return object.left;
127
169
return undefined;
171
function leftAnchorMargin()
173
if (__styleInstance === null) return 0
176
case Qt.AlignLeading:
177
return __alwaysOnScrollbars ? -nonOverlayScrollbarMargin : 0
180
if (!__alwaysOnScrollbars && __buddyScrollbar !== null
181
&& __buddyScrollbar.align === Qt.AlignLeading
182
&& __buddyScrollbar.__styleInstance.isScrollable)
183
return __buddyScrollbar.__styleInstance.troughThicknessSteppersStyle
184
//return buddyScrollbar.__styleInstance.indicatorThickness
185
// *ELSE FALLTHROUGH*
129
190
function rightAnchor(object)
131
if (!internals.vertical || (align == Qt.AlignTrailing))
192
if (!internals.vertical || (align == Qt.AlignTrailing)) {
132
193
return object.right;
133
195
return undefined;
197
function rightAnchorMargin()
199
if (__styleInstance === null) return 0
202
case Qt.AlignTrailing:
203
return __alwaysOnScrollbars ? -nonOverlayScrollbarMargin : 0
206
if (!__alwaysOnScrollbars && __buddyScrollbar !== null
207
&& __buddyScrollbar.align === Qt.AlignTrailing
208
&& __buddyScrollbar.__styleInstance.isScrollable)
209
return __buddyScrollbar.__styleInstance.troughThicknessSteppersStyle
210
//return buddyScrollbar.__styleInstance.indicatorThickness
211
// *ELSE FALLTHROUGH*
135
216
function topAnchor(object)
137
218
if (internals.vertical || (align == Qt.AlignTop))
138
219
return object.top;
139
220
return undefined;
222
function topAnchorMargin()
224
if (__styleInstance === null) return 0
228
return __alwaysOnScrollbars ? -nonOverlayScrollbarMargin : 0
229
case Qt.AlignLeading:
230
case Qt.AlignTrailing:
231
if (!__alwaysOnScrollbars && __buddyScrollbar !== null
232
&& __buddyScrollbar.align === Qt.AlignTop
233
&& __buddyScrollbar.__styleInstance.isScrollable)
234
return __buddyScrollbar.__styleInstance.troughThicknessSteppersStyle
235
//return buddyScrollbar.__styleInstance.indicatorThickness
236
// *ELSE FALLTHROUGH*
141
242
function bottomAnchor(object)
143
244
if (internals.vertical || (align == Qt.AlignBottom))
144
245
return object.bottom;
145
246
return undefined;
248
function bottomAnchorMargin()
250
if (__styleInstance === null) return 0
254
return __alwaysOnScrollbars ? -nonOverlayScrollbarMargin : 0
255
case Qt.AlignLeading:
256
case Qt.AlignTrailing:
257
if (!__alwaysOnScrollbars && __buddyScrollbar !== null
258
&& __buddyScrollbar.align === Qt.AlignBottom
259
&& __buddyScrollbar.__styleInstance.isScrollable)
260
return __buddyScrollbar.__styleInstance.troughThicknessSteppersStyle
261
//return buddyScrollbar.__styleInstance.indicatorThickness
262
// *ELSE FALLTHROUGH*
149
269
styleName: "ScrollbarStyle"