qslider.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qslider.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qslider.h"-
35#ifndef QT_NO_SLIDER-
36#ifndef QT_NO_ACCESSIBILITY-
37#include "qaccessible.h"-
38#endif-
39#include "qapplication.h"-
40#include "qevent.h"-
41#include "qpainter.h"-
42#include "qstyle.h"-
43#include "qstyleoption.h"-
44#include "private/qabstractslider_p.h"-
45#include "qdebug.h"-
46-
47QT_BEGIN_NAMESPACE-
48-
49class QSliderPrivate : public QAbstractSliderPrivate-
50{-
51 Q_DECLARE_PUBLIC(QSlider)-
52public:-
53 QStyle::SubControl pressedControl;-
54 int tickInterval;-
55 QSlider::TickPosition tickPosition;-
56 int clickOffset;-
57 void init();-
58 void resetLayoutItemMargins();-
59 int pixelPosToRangeValue(int pos) const;-
60 inline int pick(const QPoint &pt) const;-
61-
62 QStyle::SubControl newHoverControl(const QPoint &pos);-
63 bool updateHoverControl(const QPoint &pos);-
64 QStyle::SubControl hoverControl;-
65 QRect hoverRect;-
66};-
67-
68void QSliderPrivate::init()-
69{-
70 Q_Q(QSlider);-
71 pressedControl = QStyle::SC_None;-
72 tickInterval = 0;-
73 tickPosition = QSlider::NoTicks;-
74 hoverControl = QStyle::SC_None;-
75 q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy)));-
76 QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::Slider);-
77 if (orientation == Qt::Vertical)
orientation == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
78 sp.transpose();
never executed: sp.transpose();
0
79 q->setSizePolicy(sp);-
80 q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);-
81 resetLayoutItemMargins();-
82}
never executed: end of block
0
83-
84void QSliderPrivate::resetLayoutItemMargins()-
85{-
86 Q_Q(QSlider);-
87 QStyleOptionSlider opt;-
88 q->initStyleOption(&opt);-
89 setLayoutItemMargins(QStyle::SE_SliderLayoutItem, &opt);-
90}
never executed: end of block
0
91-
92int QSliderPrivate::pixelPosToRangeValue(int pos) const-
93{-
94 Q_Q(const QSlider);-
95 QStyleOptionSlider opt;-
96 q->initStyleOption(&opt);-
97 QRect gr = q->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, q);-
98 QRect sr = q->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, q);-
99 int sliderMin, sliderMax, sliderLength;-
100-
101 if (orientation == Qt::Horizontal) {
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
102 sliderLength = sr.width();-
103 sliderMin = gr.x();-
104 sliderMax = gr.right() - sliderLength + 1;-
105 } else {
never executed: end of block
0
106 sliderLength = sr.height();-
107 sliderMin = gr.y();-
108 sliderMax = gr.bottom() - sliderLength + 1;-
109 }
never executed: end of block
0
110 return QStyle::sliderValueFromPosition(minimum, maximum, pos - sliderMin,
never executed: return QStyle::sliderValueFromPosition(minimum, maximum, pos - sliderMin, sliderMax - sliderMin, opt.upsideDown);
0
111 sliderMax - sliderMin, opt.upsideDown);
never executed: return QStyle::sliderValueFromPosition(minimum, maximum, pos - sliderMin, sliderMax - sliderMin, opt.upsideDown);
0
112}-
113-
114inline int QSliderPrivate::pick(const QPoint &pt) const-
115{-
116 return orientation == Qt::Horizontal ? pt.x() : pt.y();
never executed: return orientation == Qt::Horizontal ? pt.x() : pt.y();
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
117}-
118-
119/*!-
120 Initialize \a option with the values from this QSlider. This method-
121 is useful for subclasses when they need a QStyleOptionSlider, but don't want-
122 to fill in all the information themselves.-
123-
124 \sa QStyleOption::initFrom()-
125*/-
126void QSlider::initStyleOption(QStyleOptionSlider *option) const-
127{-
128 if (!option)
!optionDescription
TRUEnever evaluated
FALSEnever evaluated
0
129 return;
never executed: return;
0
130-
131 Q_D(const QSlider);-
132 option->initFrom(this);-
133 option->subControls = QStyle::SC_None;-
134 option->activeSubControls = QStyle::SC_None;-
135 option->orientation = d->orientation;-
136 option->maximum = d->maximum;-
137 option->minimum = d->minimum;-
138 option->tickPosition = (QSlider::TickPosition)d->tickPosition;-
139 option->tickInterval = d->tickInterval;-
140 option->upsideDown = (d->orientation == Qt::Horizontal) ?
(d->orientatio...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
0
141 (d->invertedAppearance != (option->direction == Qt::RightToLeft))-
142 : (!d->invertedAppearance);-
143 option->direction = Qt::LeftToRight; // we use the upsideDown option instead-
144 option->sliderPosition = d->position;-
145 option->sliderValue = d->value;-
146 option->singleStep = d->singleStep;-
147 option->pageStep = d->pageStep;-
148 if (d->orientation == Qt::Horizontal)
d->orientation...Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
149 option->state |= QStyle::State_Horizontal;
never executed: option->state |= QStyle::State_Horizontal;
0
150}
never executed: end of block
0
151-
152bool QSliderPrivate::updateHoverControl(const QPoint &pos)-
153{-
154 Q_Q(QSlider);-
155 QRect lastHoverRect = hoverRect;-
156 QStyle::SubControl lastHoverControl = hoverControl;-
157 bool doesHover = q->testAttribute(Qt::WA_Hover);-
158 if (lastHoverControl != newHoverControl(pos) && doesHover) {
lastHoverContr...erControl(pos)Description
TRUEnever evaluated
FALSEnever evaluated
doesHoverDescription
TRUEnever evaluated
FALSEnever evaluated
0
159 q->update(lastHoverRect);-
160 q->update(hoverRect);-
161 return true;
never executed: return true;
0
162 }-
163 return !doesHover;
never executed: return !doesHover;
0
164}-
165-
166QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos)-
167{-
168 Q_Q(QSlider);-
169 QStyleOptionSlider opt;-
170 q->initStyleOption(&opt);-
171 opt.subControls = QStyle::SC_All;-
172 QRect handleRect = q->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, q);-
173 QRect grooveRect = q->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, q);-
174 QRect tickmarksRect = q->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderTickmarks, q);-
175-
176 if (handleRect.contains(pos)) {
handleRect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
177 hoverRect = handleRect;-
178 hoverControl = QStyle::SC_SliderHandle;-
179 } else if (grooveRect.contains(pos)) {
never executed: end of block
grooveRect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
180 hoverRect = grooveRect;-
181 hoverControl = QStyle::SC_SliderGroove;-
182 } else if (tickmarksRect.contains(pos)) {
never executed: end of block
tickmarksRect.contains(pos)Description
TRUEnever evaluated
FALSEnever evaluated
0
183 hoverRect = tickmarksRect;-
184 hoverControl = QStyle::SC_SliderTickmarks;-
185 } else {
never executed: end of block
0
186 hoverRect = QRect();-
187 hoverControl = QStyle::SC_None;-
188 }
never executed: end of block
0
189-
190 return hoverControl;
never executed: return hoverControl;
0
191}-
192-
193/*!-
194 \class QSlider-
195 \brief The QSlider widget provides a vertical or horizontal slider.-
196-
197 \ingroup basicwidgets-
198 \inmodule QtWidgets-
199-
200 The slider is the classic widget for controlling a bounded value.-
201 It lets the user move a slider handle along a horizontal or vertical-
202 groove and translates the handle's position into an integer value-
203 within the legal range.-
204-
205 QSlider has very few of its own functions; most of the functionality is in-
206 QAbstractSlider. The most useful functions are setValue() to set-
207 the slider directly to some value; triggerAction() to simulate-
208 the effects of clicking (useful for shortcut keys);-
209 setSingleStep(), setPageStep() to set the steps; and setMinimum()-
210 and setMaximum() to define the range of the scroll bar.-
211-
212 QSlider provides methods for controlling tickmarks. You can use-
213 setTickPosition() to indicate where you want the tickmarks to be,-
214 setTickInterval() to indicate how many of them you want. the-
215 currently set tick position and interval can be queried using the-
216 tickPosition() and tickInterval() functions, respectively.-
217-
218 QSlider inherits a comprehensive set of signals:-
219 \table-
220 \header \li Signal \li Description-
221 \row \li \l valueChanged()-
222 \li Emitted when the slider's value has changed. The tracking()-
223 determines whether this signal is emitted during user-
224 interaction.-
225 \row \li \l sliderPressed()-
226 \li Emitted when the user starts to drag the slider.-
227 \row \li \l sliderMoved()-
228 \li Emitted when the user drags the slider.-
229 \row \li \l sliderReleased()-
230 \li Emitted when the user releases the slider.-
231 \endtable-
232-
233 QSlider only provides integer ranges. Note that although-
234 QSlider handles very large numbers, it becomes difficult for users-
235 to use a slider accurately for very large ranges.-
236-
237 A slider accepts focus on Tab and provides both a mouse wheel and a-
238 keyboard interface. The keyboard interface is the following:-
239-
240 \list-
241 \li Left/Right move a horizontal slider by one single step.-
242 \li Up/Down move a vertical slider by one single step.-
243 \li PageUp moves up one page.-
244 \li PageDown moves down one page.-
245 \li Home moves to the start (mininum).-
246 \li End moves to the end (maximum).-
247 \endlist-
248-
249 \table 100%-
250 \row \li \inlineimage macintosh-slider.png Screenshot of a Macintosh slider-
251 \li A slider shown in the \l{Macintosh Style Widget Gallery}{Macintosh widget style}.-
252 \row \li \inlineimage windowsvista-slider.png Screenshot of a Windows Vista slider-
253 \li A slider shown in the \l{Windows Vista Style Widget Gallery}{Windows Vista widget style}.-
254 \row \li \inlineimage fusion-slider.png Screenshot of a Fusion slider-
255 \li A slider shown in the \l{Fusion Style Widget Gallery}{Fusion widget style}.-
256 \endtable-
257-
258 \sa QScrollBar, QSpinBox, QDial, {fowler}{GUI Design Handbook: Slider}, {Sliders Example}-
259*/-
260-
261-
262/*!-
263 \enum QSlider::TickPosition-
264-
265 This enum specifies where the tick marks are to be drawn relative-
266 to the slider's groove and the handle the user moves.-
267-
268 \value NoTicks Do not draw any tick marks.-
269 \value TicksBothSides Draw tick marks on both sides of the groove.-
270 \value TicksAbove Draw tick marks above the (horizontal) slider-
271 \value TicksBelow Draw tick marks below the (horizontal) slider-
272 \value TicksLeft Draw tick marks to the left of the (vertical) slider-
273 \value TicksRight Draw tick marks to the right of the (vertical) slider-
274*/-
275-
276-
277/*!-
278 Constructs a vertical slider with the given \a parent.-
279*/-
280QSlider::QSlider(QWidget *parent)-
281 : QAbstractSlider(*new QSliderPrivate, parent)-
282{-
283 d_func()->orientation = Qt::Vertical;-
284 d_func()->init();-
285}
never executed: end of block
0
286-
287/*!-
288 Constructs a slider with the given \a parent. The \a orientation-
289 parameter determines whether the slider is horizontal or vertical;-
290 the valid values are Qt::Vertical and Qt::Horizontal.-
291*/-
292-
293QSlider::QSlider(Qt::Orientation orientation, QWidget *parent)-
294 : QAbstractSlider(*new QSliderPrivate, parent)-
295{-
296 d_func()->orientation = orientation;-
297 d_func()->init();-
298}
never executed: end of block
0
299-
300-
301/*!-
302 Destroys this slider.-
303*/-
304QSlider::~QSlider()-
305{-
306}-
307-
308/*!-
309 \reimp-
310*/-
311void QSlider::paintEvent(QPaintEvent *)-
312{-
313 Q_D(QSlider);-
314 QPainter p(this);-
315 QStyleOptionSlider opt;-
316 initStyleOption(&opt);-
317-
318 opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;-
319 if (d->tickPosition != NoTicks)
d->tickPosition != NoTicksDescription
TRUEnever evaluated
FALSEnever evaluated
0
320 opt.subControls |= QStyle::SC_SliderTickmarks;
never executed: opt.subControls |= QStyle::SC_SliderTickmarks;
0
321 if (d->pressedControl) {
d->pressedControlDescription
TRUEnever evaluated
FALSEnever evaluated
0
322 opt.activeSubControls = d->pressedControl;-
323 opt.state |= QStyle::State_Sunken;-
324 } else {
never executed: end of block
0
325 opt.activeSubControls = d->hoverControl;-
326 }
never executed: end of block
0
327-
328 style()->drawComplexControl(QStyle::CC_Slider, &opt, &p, this);-
329}
never executed: end of block
0
330-
331/*!-
332 \reimp-
333*/-
334-
335bool QSlider::event(QEvent *event)-
336{-
337 Q_D(QSlider);-
338-
339 switch(event->type()) {-
340 case QEvent::HoverEnter:
never executed: case QEvent::HoverEnter:
0
341 case QEvent::HoverLeave:
never executed: case QEvent::HoverLeave:
0
342 case QEvent::HoverMove:
never executed: case QEvent::HoverMove:
0
343 if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
const QHoverEv...vent *>(event)Description
TRUEnever evaluated
FALSEnever evaluated
0
344 d->updateHoverControl(he->pos());
never executed: d->updateHoverControl(he->pos());
0
345 break;
never executed: break;
0
346 case QEvent::StyleChange:
never executed: case QEvent::StyleChange:
0
347 case QEvent::MacSizeChange:
never executed: case QEvent::MacSizeChange:
0
348 d->resetLayoutItemMargins();-
349 break;
never executed: break;
0
350 default:
never executed: default:
0
351 break;
never executed: break;
0
352 }-
353 return QAbstractSlider::event(event);
never executed: return QAbstractSlider::event(event);
0
354}-
355-
356/*!-
357 \reimp-
358*/-
359void QSlider::mousePressEvent(QMouseEvent *ev)-
360{-
361 Q_D(QSlider);-
362 if (d->maximum == d->minimum || (ev->buttons() ^ ev->button())) {
d->maximum == d->minimumDescription
TRUEnever evaluated
FALSEnever evaluated
(ev->buttons() ^ ev->button())Description
TRUEnever evaluated
FALSEnever evaluated
0
363 ev->ignore();-
364 return;
never executed: return;
0
365 }-
366#ifdef QT_KEYPAD_NAVIGATION-
367 if (QApplication::keypadNavigationEnabled())-
368 setEditFocus(true);-
369#endif-
370 ev->accept();-
371 if ((ev->button() & style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons)) == ev->button()) {
(ev->button() ...= ev->button()Description
TRUEnever evaluated
FALSEnever evaluated
0
372 QStyleOptionSlider opt;-
373 initStyleOption(&opt);-
374 const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);-
375 const QPoint center = sliderRect.center() - sliderRect.topLeft();-
376 // to take half of the slider off for the setSliderPosition call we use the center - topLeft-
377-
378 setSliderPosition(d->pixelPosToRangeValue(d->pick(ev->pos() - center)));-
379 triggerAction(SliderMove);-
380 setRepeatAction(SliderNoAction);-
381 d->pressedControl = QStyle::SC_SliderHandle;-
382 update();-
383 } else if ((ev->button() & style()->styleHint(QStyle::SH_Slider_PageSetButtons)) == ev->button()) {
never executed: end of block
(ev->button() ...= ev->button()Description
TRUEnever evaluated
FALSEnever evaluated
0
384 QStyleOptionSlider opt;-
385 initStyleOption(&opt);-
386 d->pressedControl = style()->hitTestComplexControl(QStyle::CC_Slider,-
387 &opt, ev->pos(), this);-
388 SliderAction action = SliderNoAction;-
389 if (d->pressedControl == QStyle::SC_SliderGroove) {
d->pressedCont...C_SliderGrooveDescription
TRUEnever evaluated
FALSEnever evaluated
0
390 const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);-
391 int pressValue = d->pixelPosToRangeValue(d->pick(ev->pos() - sliderRect.center() + sliderRect.topLeft()));-
392 d->pressValue = pressValue;-
393 if (pressValue > d->value)
pressValue > d->valueDescription
TRUEnever evaluated
FALSEnever evaluated
0
394 action = SliderPageStepAdd;
never executed: action = SliderPageStepAdd;
0
395 else if (pressValue < d->value)
pressValue < d->valueDescription
TRUEnever evaluated
FALSEnever evaluated
0
396 action = SliderPageStepSub;
never executed: action = SliderPageStepSub;
0
397 if (action) {
actionDescription
TRUEnever evaluated
FALSEnever evaluated
0
398 triggerAction(action);-
399 setRepeatAction(action);-
400 }
never executed: end of block
0
401 }
never executed: end of block
0
402 } else {
never executed: end of block
0
403 ev->ignore();-
404 return;
never executed: return;
0
405 }-
406-
407 if (d->pressedControl == QStyle::SC_SliderHandle) {
d->pressedCont...C_SliderHandleDescription
TRUEnever evaluated
FALSEnever evaluated
0
408 QStyleOptionSlider opt;-
409 initStyleOption(&opt);-
410 setRepeatAction(SliderNoAction);-
411 QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);-
412 d->clickOffset = d->pick(ev->pos() - sr.topLeft());-
413 update(sr);-
414 setSliderDown(true);-
415 }
never executed: end of block
0
416}
never executed: end of block
0
417-
418/*!-
419 \reimp-
420*/-
421void QSlider::mouseMoveEvent(QMouseEvent *ev)-
422{-
423 Q_D(QSlider);-
424 if (d->pressedControl != QStyle::SC_SliderHandle) {
d->pressedCont...C_SliderHandleDescription
TRUEnever evaluated
FALSEnever evaluated
0
425 ev->ignore();-
426 return;
never executed: return;
0
427 }-
428 ev->accept();-
429 int newPosition = d->pixelPosToRangeValue(d->pick(ev->pos()) - d->clickOffset);-
430 QStyleOptionSlider opt;-
431 initStyleOption(&opt);-
432 setSliderPosition(newPosition);-
433}
never executed: end of block
0
434-
435-
436/*!-
437 \reimp-
438*/-
439void QSlider::mouseReleaseEvent(QMouseEvent *ev)-
440{-
441 Q_D(QSlider);-
442 if (d->pressedControl == QStyle::SC_None || ev->buttons()) {
d->pressedCont...Style::SC_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
ev->buttons()Description
TRUEnever evaluated
FALSEnever evaluated
0
443 ev->ignore();-
444 return;
never executed: return;
0
445 }-
446 ev->accept();-
447 QStyle::SubControl oldPressed = QStyle::SubControl(d->pressedControl);-
448 d->pressedControl = QStyle::SC_None;-
449 setRepeatAction(SliderNoAction);-
450 if (oldPressed == QStyle::SC_SliderHandle)
oldPressed == ...C_SliderHandleDescription
TRUEnever evaluated
FALSEnever evaluated
0
451 setSliderDown(false);
never executed: setSliderDown(false);
0
452 QStyleOptionSlider opt;-
453 initStyleOption(&opt);-
454 opt.subControls = oldPressed;-
455 update(style()->subControlRect(QStyle::CC_Slider, &opt, oldPressed, this));-
456}
never executed: end of block
0
457-
458/*!-
459 \reimp-
460*/-
461QSize QSlider::sizeHint() const-
462{-
463 Q_D(const QSlider);-
464 ensurePolished();-
465 const int SliderLength = 84, TickSpace = 5;-
466 QStyleOptionSlider opt;-
467 initStyleOption(&opt);-
468 int thick = style()->pixelMetric(QStyle::PM_SliderThickness, &opt, this);-
469 if (d->tickPosition & TicksAbove)
d->tickPosition & TicksAboveDescription
TRUEnever evaluated
FALSEnever evaluated
0
470 thick += TickSpace;
never executed: thick += TickSpace;
0
471 if (d->tickPosition & TicksBelow)
d->tickPosition & TicksBelowDescription
TRUEnever evaluated
FALSEnever evaluated
0
472 thick += TickSpace;
never executed: thick += TickSpace;
0
473 int w = thick, h = SliderLength;-
474 if (d->orientation == Qt::Horizontal) {
d->orientation...Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
475 w = SliderLength;-
476 h = thick;-
477 }
never executed: end of block
0
478 return style()->sizeFromContents(QStyle::CT_Slider, &opt, QSize(w, h), this).expandedTo(QApplication::globalStrut());
never executed: return style()->sizeFromContents(QStyle::CT_Slider, &opt, QSize(w, h), this).expandedTo(QApplication::globalStrut());
0
479}-
480-
481/*!-
482 \reimp-
483*/-
484QSize QSlider::minimumSizeHint() const-
485{-
486 Q_D(const QSlider);-
487 QSize s = sizeHint();-
488 QStyleOptionSlider opt;-
489 initStyleOption(&opt);-
490 int length = style()->pixelMetric(QStyle::PM_SliderLength, &opt, this);-
491 if (d->orientation == Qt::Horizontal)
d->orientation...Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
492 s.setWidth(length);
never executed: s.setWidth(length);
0
493 else-
494 s.setHeight(length);
never executed: s.setHeight(length);
0
495 return s;
never executed: return s;
0
496}-
497-
498/*!-
499 \property QSlider::tickPosition-
500 \brief the tickmark position for this slider-
501-
502 The valid values are described by the QSlider::TickPosition enum.-
503-
504 The default value is \l QSlider::NoTicks.-
505-
506 \sa tickInterval-
507*/-
508-
509void QSlider::setTickPosition(TickPosition position)-
510{-
511 Q_D(QSlider);-
512 d->tickPosition = position;-
513 d->resetLayoutItemMargins();-
514 update();-
515 updateGeometry();-
516}
never executed: end of block
0
517-
518QSlider::TickPosition QSlider::tickPosition() const-
519{-
520 return d_func()->tickPosition;
never executed: return d_func()->tickPosition;
0
521}-
522-
523/*!-
524 \property QSlider::tickInterval-
525 \brief the interval between tickmarks-
526-
527 This is a value interval, not a pixel interval. If it is 0, the-
528 slider will choose between singleStep and pageStep.-
529-
530 The default value is 0.-
531-
532 \sa tickPosition, singleStep, pageStep-
533*/-
534-
535void QSlider::setTickInterval(int ts)-
536{-
537 d_func()->tickInterval = qMax(0, ts);-
538 update();-
539}
never executed: end of block
0
540-
541int QSlider::tickInterval() const-
542{-
543 return d_func()->tickInterval;
never executed: return d_func()->tickInterval;
0
544}-
545-
546Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider)-
547{-
548 QStyleOptionSlider sliderOption;-
549 slider->initStyleOption(&sliderOption);-
550 return sliderOption;
never executed: return sliderOption;
0
551}-
552-
553#endif-
554-
555QT_END_NAMESPACE-
556-
557#include "moc_qslider.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9