Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qabstractslider.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | QAbstractSliderPrivate::QAbstractSliderPrivate() | - | ||||||||||||
6 | : minimum(0), maximum(99), pageStep(10), value(0), position(0), pressValue(-1), | - | ||||||||||||
7 | singleStep(1), singleStepFromItemView(-1), viewMayChangeSingleStep(true), offset_accumulated(0), tracking(true), | - | ||||||||||||
8 | blocktracking(false), pressed(false), | - | ||||||||||||
9 | invertedAppearance(false), invertedControls(false), | - | ||||||||||||
10 | orientation(Qt::Horizontal), repeatAction(QAbstractSlider::SliderNoAction) | - | ||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | - | |||||||||||||
14 | - | |||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | { | - | ||||||||||||
18 | - | |||||||||||||
19 | - | |||||||||||||
20 | } never executed: end of block | 0 | ||||||||||||
21 | - | |||||||||||||
22 | QAbstractSliderPrivate::~QAbstractSliderPrivate() | - | ||||||||||||
23 | { | - | ||||||||||||
24 | } | - | ||||||||||||
25 | void QAbstractSlider::setRange(int min, int max) | - | ||||||||||||
26 | { | - | ||||||||||||
27 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
28 | int oldMin = d->minimum; | - | ||||||||||||
29 | int oldMax = d->maximum; | - | ||||||||||||
30 | d->minimum = min; | - | ||||||||||||
31 | d->maximum = qMax(min, max); | - | ||||||||||||
32 | if (oldMin != d->minimum || oldMax != d->maximum) { | - | ||||||||||||
33 | sliderChange(SliderRangeChange); | - | ||||||||||||
34 | rangeChanged(d->minimum, d->maximum); | - | ||||||||||||
35 | setValue(d->value); | - | ||||||||||||
36 | } | - | ||||||||||||
37 | } | - | ||||||||||||
38 | - | |||||||||||||
39 | - | |||||||||||||
40 | void QAbstractSliderPrivate::setSteps(int single, int page) | - | ||||||||||||
41 | { | - | ||||||||||||
42 | QAbstractSlider * const q = q_func(); | - | ||||||||||||
43 | singleStep = qAbs(single); | - | ||||||||||||
44 | pageStep = qAbs(page); | - | ||||||||||||
45 | q->sliderChange(QAbstractSlider::SliderStepsChange); | - | ||||||||||||
46 | } | - | ||||||||||||
47 | QAbstractSlider::QAbstractSlider(QWidget *parent) | - | ||||||||||||
48 | :QWidget(*new QAbstractSliderPrivate, parent, 0) | - | ||||||||||||
49 | { | - | ||||||||||||
50 | } | - | ||||||||||||
51 | - | |||||||||||||
52 | - | |||||||||||||
53 | QAbstractSlider::QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent) | - | ||||||||||||
54 | :QWidget(dd, parent, 0) | - | ||||||||||||
55 | { | - | ||||||||||||
56 | } | - | ||||||||||||
57 | - | |||||||||||||
58 | - | |||||||||||||
59 | - | |||||||||||||
60 | - | |||||||||||||
61 | QAbstractSlider::~QAbstractSlider() | - | ||||||||||||
62 | { | - | ||||||||||||
63 | } | - | ||||||||||||
64 | void QAbstractSlider::setOrientation(Qt::Orientation orientation) | - | ||||||||||||
65 | { | - | ||||||||||||
66 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
67 | if (d->orientation == orientation) | - | ||||||||||||
68 | return; | - | ||||||||||||
69 | - | |||||||||||||
70 | d->orientation = orientation; | - | ||||||||||||
71 | if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) { | - | ||||||||||||
72 | QSizePolicy sp = sizePolicy(); | - | ||||||||||||
73 | sp.transpose(); | - | ||||||||||||
74 | setSizePolicy(sp); | - | ||||||||||||
75 | setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - | ||||||||||||
76 | } | - | ||||||||||||
77 | update(); | - | ||||||||||||
78 | updateGeometry(); | - | ||||||||||||
79 | } | - | ||||||||||||
80 | - | |||||||||||||
81 | Qt::Orientation QAbstractSlider::orientation() const | - | ||||||||||||
82 | { | - | ||||||||||||
83 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
84 | return d->orientation; | - | ||||||||||||
85 | } | - | ||||||||||||
86 | void QAbstractSlider::setMinimum(int min) | - | ||||||||||||
87 | { | - | ||||||||||||
88 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
89 | setRange(min, qMax(d->maximum, min)); | - | ||||||||||||
90 | } | - | ||||||||||||
91 | - | |||||||||||||
92 | int QAbstractSlider::minimum() const | - | ||||||||||||
93 | { | - | ||||||||||||
94 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
95 | return d->minimum; | - | ||||||||||||
96 | } | - | ||||||||||||
97 | void QAbstractSlider::setMaximum(int max) | - | ||||||||||||
98 | { | - | ||||||||||||
99 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
100 | setRange(qMin(d->minimum, max), max); | - | ||||||||||||
101 | } | - | ||||||||||||
102 | - | |||||||||||||
103 | int QAbstractSlider::maximum() const | - | ||||||||||||
104 | { | - | ||||||||||||
105 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
106 | return d->maximum; | - | ||||||||||||
107 | } | - | ||||||||||||
108 | void QAbstractSlider::setSingleStep(int step) | - | ||||||||||||
109 | { | - | ||||||||||||
110 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
111 | - | |||||||||||||
112 | d->viewMayChangeSingleStep = (step < 0); | - | ||||||||||||
113 | if (step < 0
| 0 | ||||||||||||
114 | step = d->singleStepFromItemView; never executed: step = d->singleStepFromItemView; | 0 | ||||||||||||
115 | - | |||||||||||||
116 | if (step != d->singleStep
| 0 | ||||||||||||
117 | d->setSteps(step, d->pageStep); never executed: d->setSteps(step, d->pageStep); | 0 | ||||||||||||
118 | } never executed: end of block | 0 | ||||||||||||
119 | - | |||||||||||||
120 | int QAbstractSlider::singleStep() const | - | ||||||||||||
121 | { | - | ||||||||||||
122 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
123 | return d->singleStep; | - | ||||||||||||
124 | } | - | ||||||||||||
125 | void QAbstractSlider::setPageStep(int step) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
128 | if (step != d->pageStep) | - | ||||||||||||
129 | d->setSteps(d->singleStep, step); | - | ||||||||||||
130 | } | - | ||||||||||||
131 | - | |||||||||||||
132 | int QAbstractSlider::pageStep() const | - | ||||||||||||
133 | { | - | ||||||||||||
134 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
135 | return d->pageStep; | - | ||||||||||||
136 | } | - | ||||||||||||
137 | void QAbstractSlider::setTracking(bool enable) | - | ||||||||||||
138 | { | - | ||||||||||||
139 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
140 | d->tracking = enable; | - | ||||||||||||
141 | } | - | ||||||||||||
142 | - | |||||||||||||
143 | bool QAbstractSlider::hasTracking() const | - | ||||||||||||
144 | { | - | ||||||||||||
145 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
146 | return d->tracking; | - | ||||||||||||
147 | } | - | ||||||||||||
148 | void QAbstractSlider::setSliderDown(bool down) | - | ||||||||||||
149 | { | - | ||||||||||||
150 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
151 | bool doEmit = d->pressed != down; | - | ||||||||||||
152 | - | |||||||||||||
153 | d->pressed = down; | - | ||||||||||||
154 | - | |||||||||||||
155 | if (doEmit) { | - | ||||||||||||
156 | if (down) | - | ||||||||||||
157 | sliderPressed(); | - | ||||||||||||
158 | else | - | ||||||||||||
159 | sliderReleased(); | - | ||||||||||||
160 | } | - | ||||||||||||
161 | - | |||||||||||||
162 | if (!down && d->position != d->value) | - | ||||||||||||
163 | triggerAction(SliderMove); | - | ||||||||||||
164 | } | - | ||||||||||||
165 | - | |||||||||||||
166 | bool QAbstractSlider::isSliderDown() const | - | ||||||||||||
167 | { | - | ||||||||||||
168 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
169 | return d->pressed; | - | ||||||||||||
170 | } | - | ||||||||||||
171 | void QAbstractSlider::setSliderPosition(int position) | - | ||||||||||||
172 | { | - | ||||||||||||
173 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
174 | position = d->bound(position); | - | ||||||||||||
175 | if (position == d->position) | - | ||||||||||||
176 | return; | - | ||||||||||||
177 | d->position = position; | - | ||||||||||||
178 | if (!d->tracking) | - | ||||||||||||
179 | update(); | - | ||||||||||||
180 | if (d->pressed) | - | ||||||||||||
181 | sliderMoved(position); | - | ||||||||||||
182 | if (d->tracking && !d->blocktracking) | - | ||||||||||||
183 | triggerAction(SliderMove); | - | ||||||||||||
184 | } | - | ||||||||||||
185 | - | |||||||||||||
186 | int QAbstractSlider::sliderPosition() const | - | ||||||||||||
187 | { | - | ||||||||||||
188 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
189 | return d->position; | - | ||||||||||||
190 | } | - | ||||||||||||
191 | int QAbstractSlider::value() const | - | ||||||||||||
192 | { | - | ||||||||||||
193 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
194 | return d->value; | - | ||||||||||||
195 | } | - | ||||||||||||
196 | - | |||||||||||||
197 | void QAbstractSlider::setValue(int value) | - | ||||||||||||
198 | { | - | ||||||||||||
199 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
200 | value = d->bound(value); | - | ||||||||||||
201 | if (d->value == value && d->position == value) | - | ||||||||||||
202 | return; | - | ||||||||||||
203 | d->value = value; | - | ||||||||||||
204 | if (d->position != value) { | - | ||||||||||||
205 | d->position = value; | - | ||||||||||||
206 | if (d->pressed) | - | ||||||||||||
207 | sliderMoved((d->position = value)); | - | ||||||||||||
208 | } | - | ||||||||||||
209 | - | |||||||||||||
210 | QAccessibleValueChangeEvent event(this, d->value); | - | ||||||||||||
211 | QAccessible::updateAccessibility(&event); | - | ||||||||||||
212 | - | |||||||||||||
213 | sliderChange(SliderValueChange); | - | ||||||||||||
214 | valueChanged(value); | - | ||||||||||||
215 | } | - | ||||||||||||
216 | bool QAbstractSlider::invertedAppearance() const | - | ||||||||||||
217 | { | - | ||||||||||||
218 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
219 | return d->invertedAppearance; | - | ||||||||||||
220 | } | - | ||||||||||||
221 | - | |||||||||||||
222 | void QAbstractSlider::setInvertedAppearance(bool invert) | - | ||||||||||||
223 | { | - | ||||||||||||
224 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
225 | d->invertedAppearance = invert; | - | ||||||||||||
226 | update(); | - | ||||||||||||
227 | } | - | ||||||||||||
228 | bool QAbstractSlider::invertedControls() const | - | ||||||||||||
229 | { | - | ||||||||||||
230 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
231 | return d->invertedControls; | - | ||||||||||||
232 | } | - | ||||||||||||
233 | - | |||||||||||||
234 | void QAbstractSlider::setInvertedControls(bool invert) | - | ||||||||||||
235 | { | - | ||||||||||||
236 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
237 | d->invertedControls = invert; | - | ||||||||||||
238 | } | - | ||||||||||||
239 | void QAbstractSlider::triggerAction(SliderAction action) | - | ||||||||||||
240 | { | - | ||||||||||||
241 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
242 | d->blocktracking = true; | - | ||||||||||||
243 | switch (action) { | - | ||||||||||||
244 | case SliderSingleStepAdd: | - | ||||||||||||
245 | setSliderPosition(d->overflowSafeAdd(d->effectiveSingleStep())); | - | ||||||||||||
246 | break; | - | ||||||||||||
247 | case SliderSingleStepSub: | - | ||||||||||||
248 | setSliderPosition(d->overflowSafeAdd(-d->effectiveSingleStep())); | - | ||||||||||||
249 | break; | - | ||||||||||||
250 | case SliderPageStepAdd: | - | ||||||||||||
251 | setSliderPosition(d->overflowSafeAdd(d->pageStep)); | - | ||||||||||||
252 | break; | - | ||||||||||||
253 | case SliderPageStepSub: | - | ||||||||||||
254 | setSliderPosition(d->overflowSafeAdd(-d->pageStep)); | - | ||||||||||||
255 | break; | - | ||||||||||||
256 | case SliderToMinimum: | - | ||||||||||||
257 | setSliderPosition(d->minimum); | - | ||||||||||||
258 | break; | - | ||||||||||||
259 | case SliderToMaximum: | - | ||||||||||||
260 | setSliderPosition(d->maximum); | - | ||||||||||||
261 | break; | - | ||||||||||||
262 | case SliderMove: | - | ||||||||||||
263 | case SliderNoAction: | - | ||||||||||||
264 | break; | - | ||||||||||||
265 | }; | - | ||||||||||||
266 | actionTriggered(action); | - | ||||||||||||
267 | d->blocktracking = false; | - | ||||||||||||
268 | setValue(d->position); | - | ||||||||||||
269 | } | - | ||||||||||||
270 | - | |||||||||||||
271 | - | |||||||||||||
272 | - | |||||||||||||
273 | - | |||||||||||||
274 | - | |||||||||||||
275 | - | |||||||||||||
276 | void QAbstractSlider::setRepeatAction(SliderAction action, int thresholdTime, int repeatTime) | - | ||||||||||||
277 | { | - | ||||||||||||
278 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
279 | if ((d->repeatAction = action) == SliderNoAction) { | - | ||||||||||||
280 | d->repeatActionTimer.stop(); | - | ||||||||||||
281 | } else { | - | ||||||||||||
282 | d->repeatActionTime = repeatTime; | - | ||||||||||||
283 | d->repeatActionTimer.start(thresholdTime, this); | - | ||||||||||||
284 | } | - | ||||||||||||
285 | } | - | ||||||||||||
286 | - | |||||||||||||
287 | - | |||||||||||||
288 | - | |||||||||||||
289 | - | |||||||||||||
290 | - | |||||||||||||
291 | QAbstractSlider::SliderAction QAbstractSlider::repeatAction() const | - | ||||||||||||
292 | { | - | ||||||||||||
293 | const QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
294 | return d->repeatAction; | - | ||||||||||||
295 | } | - | ||||||||||||
296 | - | |||||||||||||
297 | - | |||||||||||||
298 | - | |||||||||||||
299 | void QAbstractSlider::timerEvent(QTimerEvent *e) | - | ||||||||||||
300 | { | - | ||||||||||||
301 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
302 | if (e->timerId() == d->repeatActionTimer.timerId()) { | - | ||||||||||||
303 | if (d->repeatActionTime) { | - | ||||||||||||
304 | d->repeatActionTimer.start(d->repeatActionTime, this); | - | ||||||||||||
305 | d->repeatActionTime = 0; | - | ||||||||||||
306 | } | - | ||||||||||||
307 | if (d->repeatAction == SliderPageStepAdd) | - | ||||||||||||
308 | d->setAdjustedSliderPosition(d->overflowSafeAdd(d->pageStep)); | - | ||||||||||||
309 | else if (d->repeatAction == SliderPageStepSub) | - | ||||||||||||
310 | d->setAdjustedSliderPosition(d->overflowSafeAdd(-d->pageStep)); | - | ||||||||||||
311 | else | - | ||||||||||||
312 | triggerAction(d->repeatAction); | - | ||||||||||||
313 | } | - | ||||||||||||
314 | } | - | ||||||||||||
315 | void QAbstractSlider::sliderChange(SliderChange) | - | ||||||||||||
316 | { | - | ||||||||||||
317 | update(); | - | ||||||||||||
318 | } | - | ||||||||||||
319 | - | |||||||||||||
320 | bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::KeyboardModifiers modifiers, int delta) | - | ||||||||||||
321 | { | - | ||||||||||||
322 | QAbstractSlider * const q = q_func(); | - | ||||||||||||
323 | int stepsToScroll = 0; | - | ||||||||||||
324 | - | |||||||||||||
325 | if (orientation == Qt::Horizontal) | - | ||||||||||||
326 | delta = -delta; | - | ||||||||||||
327 | qreal offset = qreal(delta) / 120; | - | ||||||||||||
328 | - | |||||||||||||
329 | if ((modifiers & Qt::ControlModifier) || (modifiers & Qt::ShiftModifier)) { | - | ||||||||||||
330 | - | |||||||||||||
331 | stepsToScroll = qBound(-pageStep, int(offset * pageStep), pageStep); | - | ||||||||||||
332 | offset_accumulated = 0; | - | ||||||||||||
333 | } else { | - | ||||||||||||
334 | - | |||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | qreal stepsToScrollF = | - | ||||||||||||
338 | - | |||||||||||||
339 | QApplication::wheelScrollLines() * | - | ||||||||||||
340 | - | |||||||||||||
341 | offset * effectiveSingleStep(); | - | ||||||||||||
342 | - | |||||||||||||
343 | if (offset_accumulated != 0 && (offset / offset_accumulated) < 0) | - | ||||||||||||
344 | offset_accumulated = 0; | - | ||||||||||||
345 | - | |||||||||||||
346 | offset_accumulated += stepsToScrollF; | - | ||||||||||||
347 | - | |||||||||||||
348 | - | |||||||||||||
349 | stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep); | - | ||||||||||||
350 | - | |||||||||||||
351 | - | |||||||||||||
352 | - | |||||||||||||
353 | - | |||||||||||||
354 | - | |||||||||||||
355 | - | |||||||||||||
356 | offset_accumulated -= int(offset_accumulated); | - | ||||||||||||
357 | if (stepsToScroll == 0) { | - | ||||||||||||
358 | - | |||||||||||||
359 | - | |||||||||||||
360 | const float effective_offset = invertedControls ? -offset_accumulated : offset_accumulated; | - | ||||||||||||
361 | if (effective_offset > 0.f && value < maximum) | - | ||||||||||||
362 | return true; | - | ||||||||||||
363 | if (effective_offset < 0.f && value > minimum) | - | ||||||||||||
364 | return true; | - | ||||||||||||
365 | offset_accumulated = 0; | - | ||||||||||||
366 | return false; | - | ||||||||||||
367 | } | - | ||||||||||||
368 | } | - | ||||||||||||
369 | - | |||||||||||||
370 | if (invertedControls) | - | ||||||||||||
371 | stepsToScroll = -stepsToScroll; | - | ||||||||||||
372 | - | |||||||||||||
373 | int prevValue = value; | - | ||||||||||||
374 | position = bound(overflowSafeAdd(stepsToScroll)); | - | ||||||||||||
375 | q->triggerAction(QAbstractSlider::SliderMove); | - | ||||||||||||
376 | - | |||||||||||||
377 | if (prevValue == value) { | - | ||||||||||||
378 | offset_accumulated = 0; | - | ||||||||||||
379 | return false; | - | ||||||||||||
380 | } | - | ||||||||||||
381 | return true; | - | ||||||||||||
382 | } | - | ||||||||||||
383 | - | |||||||||||||
384 | - | |||||||||||||
385 | - | |||||||||||||
386 | - | |||||||||||||
387 | - | |||||||||||||
388 | void QAbstractSlider::wheelEvent(QWheelEvent * e) | - | ||||||||||||
389 | { | - | ||||||||||||
390 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
391 | e->ignore(); | - | ||||||||||||
392 | int delta = e->delta(); | - | ||||||||||||
393 | if (e->inverted()
| 0 | ||||||||||||
394 | delta = -delta; never executed: delta = -delta; | 0 | ||||||||||||
395 | if (d->scrollByDelta(e->orientation(), e->modifiers(), delta)
| 0 | ||||||||||||
396 | e->accept(); never executed: e->accept(); | 0 | ||||||||||||
397 | } never executed: end of block | 0 | ||||||||||||
398 | - | |||||||||||||
399 | - | |||||||||||||
400 | - | |||||||||||||
401 | - | |||||||||||||
402 | - | |||||||||||||
403 | - | |||||||||||||
404 | void QAbstractSlider::keyPressEvent(QKeyEvent *ev) | - | ||||||||||||
405 | { | - | ||||||||||||
406 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
407 | SliderAction action = SliderNoAction; | - | ||||||||||||
408 | switch (ev->key()) { | - | ||||||||||||
409 | case Qt::Key_Left: | - | ||||||||||||
410 | if (isRightToLeft()) | - | ||||||||||||
411 | action = d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd; | - | ||||||||||||
412 | else | - | ||||||||||||
413 | action = !d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd; | - | ||||||||||||
414 | break; | - | ||||||||||||
415 | case Qt::Key_Right: | - | ||||||||||||
416 | if (isRightToLeft()) | - | ||||||||||||
417 | action = d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub; | - | ||||||||||||
418 | else | - | ||||||||||||
419 | action = !d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub; | - | ||||||||||||
420 | break; | - | ||||||||||||
421 | case Qt::Key_Up: | - | ||||||||||||
422 | action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd; | - | ||||||||||||
423 | break; | - | ||||||||||||
424 | case Qt::Key_Down: | - | ||||||||||||
425 | action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub; | - | ||||||||||||
426 | break; | - | ||||||||||||
427 | case Qt::Key_PageUp: | - | ||||||||||||
428 | action = d->invertedControls ? SliderPageStepSub : SliderPageStepAdd; | - | ||||||||||||
429 | break; | - | ||||||||||||
430 | case Qt::Key_PageDown: | - | ||||||||||||
431 | action = d->invertedControls ? SliderPageStepAdd : SliderPageStepSub; | - | ||||||||||||
432 | break; | - | ||||||||||||
433 | case Qt::Key_Home: | - | ||||||||||||
434 | action = SliderToMinimum; | - | ||||||||||||
435 | break; | - | ||||||||||||
436 | case Qt::Key_End: | - | ||||||||||||
437 | action = SliderToMaximum; | - | ||||||||||||
438 | break; | - | ||||||||||||
439 | default: | - | ||||||||||||
440 | ev->ignore(); | - | ||||||||||||
441 | break; | - | ||||||||||||
442 | } | - | ||||||||||||
443 | if (action) | - | ||||||||||||
444 | triggerAction(action); | - | ||||||||||||
445 | } | - | ||||||||||||
446 | - | |||||||||||||
447 | - | |||||||||||||
448 | - | |||||||||||||
449 | - | |||||||||||||
450 | void QAbstractSlider::changeEvent(QEvent *ev) | - | ||||||||||||
451 | { | - | ||||||||||||
452 | QAbstractSliderPrivate * const d = d_func(); | - | ||||||||||||
453 | switch (ev->type()) { | - | ||||||||||||
454 | case QEvent::EnabledChange: | - | ||||||||||||
455 | if (!isEnabled()) { | - | ||||||||||||
456 | d->repeatActionTimer.stop(); | - | ||||||||||||
457 | setSliderDown(false); | - | ||||||||||||
458 | } | - | ||||||||||||
459 | - | |||||||||||||
460 | default: | - | ||||||||||||
461 | QWidget::changeEvent(ev); | - | ||||||||||||
462 | } | - | ||||||||||||
463 | } | - | ||||||||||||
464 | - | |||||||||||||
465 | - | |||||||||||||
466 | - | |||||||||||||
467 | - | |||||||||||||
468 | bool QAbstractSlider::event(QEvent *e) | - | ||||||||||||
469 | { | - | ||||||||||||
470 | return QWidget::event(e); | - | ||||||||||||
471 | } | - | ||||||||||||
472 | - | |||||||||||||
473 | - | |||||||||||||
474 | - | |||||||||||||
475 | - | |||||||||||||
476 | - | |||||||||||||
477 | - | |||||||||||||
478 | void QAbstractSliderPrivate::itemviewChangeSingleStep(int step) | - | ||||||||||||
479 | { | - | ||||||||||||
480 | singleStepFromItemView = step; | - | ||||||||||||
481 | if (viewMayChangeSingleStep
| 0 | ||||||||||||
482 | setSteps(step, pageStep never executed: setSteps(step, pageStep); never executed: );setSteps(step, pageStep); never executed: setSteps(step, pageStep); | 0 | ||||||||||||
483 | } never executed: end of block | 0 | ||||||||||||
484 | - | |||||||||||||
485 | - | |||||||||||||
486 | - | |||||||||||||
Switch to Source code | Preprocessed file |