GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ctkRangeSlider.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.commontk.org/LICENSE
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 // Qt includes
22 #include <QDebug>
23 #include <QMouseEvent>
24 #include <QKeyEvent>
25 #include <QStyleOptionSlider>
26 #include <QApplication>
27 #include <QStylePainter>
28 #include <QStyle>
29 
30 // CTK includes
31 #include "ctkRangeSlider.h"
32 
34 {
36 protected:
38 public:
40  void init();
41 
43  int pixelPosToRangeValue(int pos) const;
44  int pixelPosFromRangeValue(int val) const;
45 
47  void drawMinimumSlider( QStylePainter* painter ) const;
48  void drawMaximumSlider( QStylePainter* painter ) const;
49 
53 
57 
59  QStyle::SubControl m_MinimumSliderSelected;
60  QStyle::SubControl m_MaximumSliderSelected;
61 
65 
69 
72 
75  enum Handle {
76  NoHandle = 0x0,
79  };
80  Q_DECLARE_FLAGS(Handles, Handle);
81  ctkRangeSliderPrivate::Handles m_SelectedHandles;
82 
86 };
87 
88 // --------------------------------------------------------------------------
90  :q_ptr(&object)
91 {
92  this->m_MinimumValue = 0;
93  this->m_MaximumValue = 100;
94  this->m_MinimumPosition = 0;
95  this->m_MaximumPosition = 100;
96  this->m_MinimumSliderSelected = QStyle::SC_None;
97  this->m_MaximumSliderSelected = QStyle::SC_None;
98  this->m_SubclassClickOffset = 0;
99  this->m_SubclassPosition = 0;
100  this->m_SubclassWidth = 0;
101  this->m_SelectedHandles = 0;
102  this->m_SymmetricMoves = false;
103 }
104 
105 // --------------------------------------------------------------------------
107 {
108  Q_Q(ctkRangeSlider);
109  this->m_MinimumValue = q->minimum();
110  this->m_MaximumValue = q->maximum();
111  this->m_MinimumPosition = q->minimum();
112  this->m_MaximumPosition = q->maximum();
113  q->connect(q, SIGNAL(rangeChanged(int, int)), q, SLOT(onRangeChanged(int, int)));
114 }
115 
116 // --------------------------------------------------------------------------
117 // Copied verbatim from QSliderPrivate::pixelPosToRangeValue. See QSlider.cpp
118 //
120 {
121  Q_Q(const ctkRangeSlider);
122  QStyleOptionSlider option;
123  q->initStyleOption( &option );
124 
125  QRect gr = q->style()->subControlRect( QStyle::CC_Slider,
126  &option,
127  QStyle::SC_SliderGroove,
128  q );
129  QRect sr = q->style()->subControlRect( QStyle::CC_Slider,
130  &option,
131  QStyle::SC_SliderHandle,
132  q );
133  int sliderMin, sliderMax, sliderLength;
134  if (option.orientation == Qt::Horizontal)
135  {
136  sliderLength = sr.width();
137  sliderMin = gr.x();
138  sliderMax = gr.right() - sliderLength + 1;
139  }
140  else
141  {
142  sliderLength = sr.height();
143  sliderMin = gr.y();
144  sliderMax = gr.bottom() - sliderLength + 1;
145  }
146 
147  return QStyle::sliderValueFromPosition( q->minimum(),
148  q->maximum(),
149  pos - sliderMin,
150  sliderMax - sliderMin,
151  option.upsideDown );
152 }
153 
154 //---------------------------------------------------------------------------
156 {
157  Q_Q(const ctkRangeSlider);
158  QStyleOptionSlider option;
159  q->initStyleOption( &option );
160 
161  QRect gr = q->style()->subControlRect( QStyle::CC_Slider,
162  &option,
163  QStyle::SC_SliderGroove,
164  q );
165  QRect sr = q->style()->subControlRect( QStyle::CC_Slider,
166  &option,
167  QStyle::SC_SliderHandle,
168  q );
169  int sliderMin, sliderMax, sliderLength;
170  if (option.orientation == Qt::Horizontal)
171  {
172  sliderLength = sr.width();
173  sliderMin = gr.x();
174  sliderMax = gr.right() - sliderLength + 1;
175  }
176  else
177  {
178  sliderLength = sr.height();
179  sliderMin = gr.y();
180  sliderMax = gr.bottom() - sliderLength + 1;
181  }
182 
183  return QStyle::sliderPositionFromValue( q->minimum(),
184  q->maximum(),
185  val,
186  sliderMax - sliderMin,
187  option.upsideDown ) + sliderMin;
188 }
189 
190 //---------------------------------------------------------------------------
191 // Draw slider at the bottom end of the range
193 {
194  Q_Q(const ctkRangeSlider);
195  QStyleOptionSlider option;
196  q->initMinimumSliderStyleOption( &option );
197 
198  option.subControls = QStyle::SC_SliderHandle;
199  option.sliderValue = m_MinimumValue;
200  option.sliderPosition = m_MinimumPosition;
201  if (this->m_SelectedHandles & MinimumHandle)
202  {
203  option.activeSubControls = QStyle::SC_SliderHandle;
204  option.state |= QStyle::State_Sunken;
205  }
206 
207  painter->drawComplexControl(QStyle::CC_Slider, option);
208 }
209 
210 //---------------------------------------------------------------------------
211 // Draw slider at the top end of the range
213 {
214  Q_Q(const ctkRangeSlider);
215  QStyleOptionSlider option;
216  q->initMaximumSliderStyleOption( &option );
217 
218  option.subControls = QStyle::SC_SliderHandle;
219  option.sliderValue = m_MaximumValue;
220  option.sliderPosition = m_MaximumPosition;
221  if (this->m_SelectedHandles & MaximumHandle)
222  {
223  option.activeSubControls = QStyle::SC_SliderHandle;
224  option.state |= QStyle::State_Sunken;
225  }
226  painter->drawComplexControl(QStyle::CC_Slider, option);
227 }
228 
229 // --------------------------------------------------------------------------
231  : QSlider(iParent)
232  , d_ptr(new ctkRangeSliderPrivate(*this))
233 {
234  Q_D(ctkRangeSlider);
235  d->init();
236 }
237 
238 // --------------------------------------------------------------------------
240  QWidget* parentObject )
241  :QSlider(o, parentObject)
242  , d_ptr(new ctkRangeSliderPrivate(*this))
243 {
244  Q_D(ctkRangeSlider);
245  d->init();
246 }
247 
248 // --------------------------------------------------------------------------
250  : QSlider(iParent)
251  , d_ptr(impl)
252 {
253  Q_D(ctkRangeSlider);
254  d->init();
255 }
256 
257 // --------------------------------------------------------------------------
259  QWidget* parentObject )
260  :QSlider(o, parentObject)
261  , d_ptr(impl)
262 {
263  Q_D(ctkRangeSlider);
264  d->init();
265 }
266 
267 // --------------------------------------------------------------------------
269 {
270 }
271 
272 // --------------------------------------------------------------------------
274 {
275  Q_D(const ctkRangeSlider);
276  return d->m_MinimumValue;
277 }
278 
279 // --------------------------------------------------------------------------
281 {
282  Q_D(ctkRangeSlider);
283  this->setValues( min, qMax(d->m_MaximumValue,min) );
284 }
285 
286 // --------------------------------------------------------------------------
288 {
289  Q_D(const ctkRangeSlider);
290  return d->m_MaximumValue;
291 }
292 
293 // --------------------------------------------------------------------------
295 {
296  Q_D(ctkRangeSlider);
297  this->setValues( qMin(d->m_MinimumValue, max), max );
298 }
299 
300 // --------------------------------------------------------------------------
301 void ctkRangeSlider::setValues(int l, int u)
302 {
303  Q_D(ctkRangeSlider);
304  const int t_minimumValue =
305  qBound(this->minimum(), qMin(l,u), this->maximum());
306  const int t_maximumValue =
307  qBound(this->minimum(), qMax(l,u), this->maximum());
308  bool emitMinValChanged = (t_minimumValue != d->m_MinimumValue);
309  bool emitMaxValChanged = (t_maximumValue != d->m_MaximumValue);
310 
311  d->m_MinimumValue = t_minimumValue;
312  d->m_MaximumValue = t_maximumValue;
313 
314  bool emitMinPosChanged =
315  (t_minimumValue != d->m_MinimumPosition);
316  bool emitMaxPosChanged =
317  (t_maximumValue != d->m_MaximumPosition);
318  d->m_MinimumPosition = t_minimumValue;
319  d->m_MaximumPosition = t_maximumValue;
320 
321  if (isSliderDown())
322  {
323  if (emitMinPosChanged || emitMaxPosChanged)
324  {
325  emit positionsChanged(t_minimumValue, t_maximumValue);
326  }
327  if (emitMinPosChanged)
328  {
329  emit minimumPositionChanged(t_minimumValue);
330  }
331  if (emitMaxPosChanged)
332  {
333  emit maximumPositionChanged(t_maximumValue);
334  }
335  }
336  if (emitMinValChanged || emitMaxValChanged)
337  {
338  emit valuesChanged(d->m_MinimumValue,
339  d->m_MaximumValue);
340  }
341  if (emitMinValChanged)
342  {
343  emit minimumValueChanged(t_minimumValue);
344  }
345  if (emitMaxValChanged)
346  {
347  emit maximumValueChanged(t_maximumValue);
348  }
349  if (emitMinPosChanged || emitMaxPosChanged ||
350  emitMinValChanged || emitMaxValChanged)
351  {
352  this->update();
353  }
354 }
355 
356 // --------------------------------------------------------------------------
358 {
359  Q_D(const ctkRangeSlider);
360  return d->m_MinimumPosition;
361 }
362 
363 // --------------------------------------------------------------------------
365 {
366  Q_D(const ctkRangeSlider);
367  return d->m_MaximumPosition;
368 }
369 
370 // --------------------------------------------------------------------------
372 {
373  Q_D(const ctkRangeSlider);
374  this->setPositions(l, qMax(l, d->m_MaximumPosition));
375 }
376 
377 // --------------------------------------------------------------------------
379 {
380  Q_D(const ctkRangeSlider);
381  this->setPositions(qMin(d->m_MinimumPosition, u), u);
382 }
383 
384 // --------------------------------------------------------------------------
385 void ctkRangeSlider::setPositions(int min, int max)
386 {
387  Q_D(ctkRangeSlider);
388  const int minPosition =
389  qBound(this->minimum(), qMin(min, max), this->maximum());
390  const int maxPosition =
391  qBound(this->minimum(), qMax(min, max), this->maximum());
392 
393  bool emitMinPosChanged = (minPosition != d->m_MinimumPosition);
394  bool emitMaxPosChanged = (maxPosition != d->m_MaximumPosition);
395 
396  if (!emitMinPosChanged && !emitMaxPosChanged)
397  {
398  return;
399  }
400 
401  d->m_MinimumPosition = minPosition;
402  d->m_MaximumPosition = maxPosition;
403 
404  if (!this->hasTracking())
405  {
406  this->update();
407  }
408  if (isSliderDown())
409  {
410  if (emitMinPosChanged)
411  {
412  emit minimumPositionChanged(d->m_MinimumPosition);
413  }
414  if (emitMaxPosChanged)
415  {
416  emit maximumPositionChanged(d->m_MaximumPosition);
417  }
418  if (emitMinPosChanged || emitMaxPosChanged)
419  {
420  emit positionsChanged(d->m_MinimumPosition, d->m_MaximumPosition);
421  }
422  }
423  if (this->hasTracking())
424  {
425  this->triggerAction(SliderMove);
426  this->setValues(d->m_MinimumPosition, d->m_MaximumPosition);
427  }
428 }
429 
430 // --------------------------------------------------------------------------
432 {
433  Q_D(ctkRangeSlider);
434  d->m_SymmetricMoves = symmetry;
435 }
436 
437 // --------------------------------------------------------------------------
439 {
440  Q_D(const ctkRangeSlider);
441  return d->m_SymmetricMoves;
442 }
443 
444 // --------------------------------------------------------------------------
445 void ctkRangeSlider::onRangeChanged(int t_minimum, int t_maximum)
446 {
447  Q_UNUSED(t_minimum);
448  Q_UNUSED(t_maximum);
449  Q_D(ctkRangeSlider);
450  this->setValues(d->m_MinimumValue, d->m_MaximumValue);
451 }
452 
453 // --------------------------------------------------------------------------
454 // Render
456 {
457  Q_D(ctkRangeSlider);
458  QStyleOptionSlider option;
459  this->initStyleOption(&option);
460 
461  QStylePainter painter(this);
462  option.subControls = QStyle::SC_SliderGroove;
463  option.sliderPosition = this->minimum(); // don't highlight the SliderGroove
464  painter.drawComplexControl(QStyle::CC_Slider, option);
465 
466  option.sliderPosition = d->m_MinimumPosition;
467  const QRect lr = style()->subControlRect( QStyle::CC_Slider,
468  &option,
469  QStyle::SC_SliderHandle,
470  this);
471  option.sliderPosition = d->m_MaximumPosition;
472 
473  const QRect ur = style()->subControlRect( QStyle::CC_Slider,
474  &option,
475  QStyle::SC_SliderHandle,
476  this);
477 
478  QRect sr = style()->subControlRect( QStyle::CC_Slider,
479  &option,
480  QStyle::SC_SliderGroove,
481  this);
482  QRect rangeBox;
483  if (option.orientation == Qt::Horizontal)
484  {
485  rangeBox = QRect(
486  QPoint(qMin( lr.center().x(), ur.center().x() ), sr.center().y() - 2),
487  QPoint(qMax( lr.center().x(), ur.center().x() ), sr.center().y() + 1));
488  }
489  else
490  {
491  rangeBox = QRect(
492  QPoint(sr.center().x() - 2, qMin( lr.center().y(), ur.center().y() )),
493  QPoint(sr.center().x() + 1, qMax( lr.center().y(), ur.center().y() )));
494  }
495 
496  // -----------------------------
497  // Render the range
498  //
499  QRect groove = this->style()->subControlRect( QStyle::CC_Slider,
500  &option,
501  QStyle::SC_SliderGroove,
502  this );
503  groove.adjust(0, 0, -1, 0);
504 
505  // Create default colors based on the transfer function.
506  //
507  QColor highlight = this->palette().color(QPalette::Normal, QPalette::Highlight);
508  QLinearGradient gradient;
509  if (option.orientation == Qt::Horizontal)
510  {
511  gradient = QLinearGradient( groove.center().x(), groove.top(),
512  groove.center().x(), groove.bottom());
513  }
514  else
515  {
516  gradient = QLinearGradient( groove.left(), groove.center().y(),
517  groove.right(), groove.center().y());
518  }
519 
520  // TODO: Set this based on the supplied transfer function
521 // QColor l = Qt::darkGray;
522 // QColor u = Qt::black;
523 
524  gradient.setColorAt(0, highlight.darker(120));
525  gradient.setColorAt(1, highlight.lighter(160));
526 
527  painter.setPen(QPen(highlight.darker(150), 0));
528  painter.setBrush(gradient);
529  painter.drawRect( rangeBox.intersected(groove) );
530 
531  // -----------------------------------
532  // Render the sliders
533  //
534  if (d->m_SelectedHandles & ctkRangeSliderPrivate::MinimumHandle)
535  {
536  d->drawMaximumSlider( &painter );
537  d->drawMinimumSlider( &painter );
538  }
539  else
540  {
541  d->drawMinimumSlider( &painter );
542  d->drawMaximumSlider( &painter );
543  }
544 }
545 
546 // --------------------------------------------------------------------------
547 // Standard Qt UI events
549 {
550  Q_D(ctkRangeSlider);
551  if (minimum() == maximum() || (mouseEvent->buttons() ^ mouseEvent->button()))
552  {
553  mouseEvent->ignore();
554  return;
555  }
556  int t_pos = this->orientation() == Qt::Horizontal ?
557  mouseEvent->pos().x() : mouseEvent->pos().y();
558 
559  QStyleOptionSlider option;
560  this->initStyleOption( &option );
561 
562  // Check if the first handle is pressed
563 
564  option.sliderPosition = d->m_MinimumPosition;
565  option.sliderValue = d->m_MinimumValue;
566 
567  QStyle::SubControl control;
568  control = this->style()->hitTestComplexControl( QStyle::CC_Slider,
569  &option,
570  mouseEvent->pos(),
571  this);
572  const QRect lr = this->style()->subControlRect( QStyle::CC_Slider,
573  &option,
574  QStyle::SC_SliderHandle,
575  this);
576  if (control == QStyle::SC_SliderHandle)
577  {
578  d->m_SubclassPosition = d->m_MinimumPosition;
579 
580  // save the position of the mouse inside the handle for later
581  d->m_SubclassClickOffset = t_pos - (this->orientation() == Qt::Horizontal ?
582  lr.left() : lr.top());
583 
584  this->setSliderDown(true);
585 
586  if (d->m_SelectedHandles != ctkRangeSliderPrivate::MinimumHandle)
587  {
588  d->m_SelectedHandles = ctkRangeSliderPrivate::MinimumHandle;
589  this->update(lr);
590  }
591  // Accept the mouseEvent
592  mouseEvent->accept();
593  return;
594  }
595 
596 
597  // The user didn't press on the minimum handle,
598  // Check if the other handle is pressed
599 
600  option.sliderPosition = d->m_MaximumPosition;
601  option.sliderValue = d->m_MaximumValue;
602 
603  control = this->style()->hitTestComplexControl( QStyle::CC_Slider,
604  &option,
605  mouseEvent->pos(),
606  this);
607  const QRect ur = this->style()->subControlRect( QStyle::CC_Slider,
608  &option,
609  QStyle::SC_SliderHandle,
610  this);
611  if (control == QStyle::SC_SliderHandle)
612  {
613  d->m_SubclassPosition = d->m_MaximumPosition;
614 
615  // save the position of the mouse inside the handle for later
616  d->m_SubclassClickOffset = t_pos - (this->orientation() == Qt::Horizontal ?
617  ur.left() : ur.top());
618 
619  this->setSliderDown(true);
620 
621  if (d->m_SelectedHandles != ctkRangeSliderPrivate::MaximumHandle)
622  {
623  d->m_SelectedHandles = ctkRangeSliderPrivate::MaximumHandle;
624  this->update(ur);
625  }
626  // Accept the mouseEvent
627  mouseEvent->accept();
628  return;
629  }
630 
631  // if we are here, no handles have been pressed
632  // Check if we pressed on the groove between the 2 handles
633 
634  control = this->style()->hitTestComplexControl( QStyle::CC_Slider,
635  &option,
636  mouseEvent->pos(),
637  this);
638  QRect sr = style()->subControlRect( QStyle::CC_Slider,
639  &option,
640  QStyle::SC_SliderGroove,
641  this);
642  int minCenter = (this->orientation() == Qt::Horizontal ?
643  lr.center().x() : ur.center().y());
644  int maxCenter = (this->orientation() == Qt::Horizontal ?
645  ur.center().x() : lr.center().y());
646  if (control == QStyle::SC_SliderGroove &&
647  t_pos > minCenter && t_pos < maxCenter)
648  {
649  // warning lost of precision it might be fatal
650  d->m_SubclassPosition = (d->m_MinimumPosition + d->m_MaximumPosition) / 2.;
651  d->m_SubclassClickOffset = t_pos - d->pixelPosFromRangeValue(d->m_SubclassPosition);
652  d->m_SubclassWidth = (d->m_MaximumPosition - d->m_MinimumPosition) / 2;
653  qMax(d->m_SubclassPosition - d->m_MinimumPosition, d->m_MaximumPosition - d->m_SubclassPosition);
654  this->setSliderDown(true);
655  if (!(d->m_SelectedHandles & QFlags<ctkRangeSliderPrivate::Handle>(
658  {
659  d->m_SelectedHandles =
662  this->update(lr.united(ur).united(sr));
663  }
664  mouseEvent->accept();
665  return;
666  }
667  mouseEvent->ignore();
668 }
669 
670 // --------------------------------------------------------------------------
671 // Standard Qt UI events
673 {
674  Q_D(ctkRangeSlider);
675  if (!d->m_SelectedHandles)
676  {
677  mouseEvent->ignore();
678  return;
679  }
680  int t_pos = this->orientation() == Qt::Horizontal ?
681  mouseEvent->pos().x() : mouseEvent->pos().y();
682 
683  QStyleOptionSlider option;
684  this->initStyleOption(&option);
685 
686  const int m = style()->pixelMetric( QStyle::PM_MaximumDragDistance, &option, this );
687 
688  int newPosition = d->pixelPosToRangeValue(t_pos - d->m_SubclassClickOffset);
689 
690  if (m >= 0)
691  {
692  const QRect r = rect().adjusted(-m, -m, m, m);
693  if (!r.contains(mouseEvent->pos()))
694  {
695  newPosition = d->m_SubclassPosition;
696  }
697  }
698 
699  // The lower/left slider is down
700  if (d->m_SelectedHandles == ctkRangeSliderPrivate::MinimumHandle)
701  {
702  double newMinPos = qMin(newPosition,d->m_MaximumPosition);
703  this->setPositions(newMinPos, d->m_MaximumPosition +
704  (d->m_SymmetricMoves ? d->m_MinimumPosition - newMinPos : 0));
705  }
706  // The upper/right slider is down
707  else if (d->m_SelectedHandles == ctkRangeSliderPrivate::MaximumHandle)
708  {
709  double newMaxPos = qMax(d->m_MinimumPosition, newPosition);
710  this->setPositions(d->m_MinimumPosition -
711  (d->m_SymmetricMoves ? newMaxPos - d->m_MaximumPosition: 0),
712  newMaxPos);
713  }
714  // Both handles are down (the user clicked in between the handles)
715  else if (d->m_SelectedHandles & ctkRangeSliderPrivate::MinimumHandle &&
716  d->m_SelectedHandles & ctkRangeSliderPrivate::MaximumHandle)
717  {
718  this->setPositions(newPosition - d->m_SubclassWidth,
719  newPosition + d->m_SubclassWidth );
720  }
721  mouseEvent->accept();
722 }
723 
724 // --------------------------------------------------------------------------
725 // Standard Qt UI mouseEvents
727 {
728  Q_D(ctkRangeSlider);
729  this->QSlider::mouseReleaseEvent(mouseEvent);
730 
731  setSliderDown(false);
732  d->m_SelectedHandles = 0;
733 
734  this->update();
735 }
736 
737 // --------------------------------------------------------------------------
739 {
740  Q_D(const ctkRangeSlider);
741  return d->m_SelectedHandles & ctkRangeSliderPrivate::MinimumHandle;
742 }
743 
744 // --------------------------------------------------------------------------
746 {
747  Q_D(const ctkRangeSlider);
748  return d->m_SelectedHandles & ctkRangeSliderPrivate::MaximumHandle;
749 }
750 
751 // --------------------------------------------------------------------------
753 {
754  this->initStyleOption(option);
755 }
756 
757 // --------------------------------------------------------------------------
759 {
760  this->initStyleOption(option);
761 }
virtual void mouseReleaseEvent(QMouseEvent *ev)
virtual void initMaximumSliderStyleOption(QStyleOptionSlider *option) const
void minimumValueChanged(int min)
void setMaximumPosition(int max)
void drawMinimumSlider(QStylePainter *painter) const
Draw the bottom and top sliders.
int minimumPosition() const
ctkRangeSliderPrivate::Handles m_SelectedHandles
const QPalette & palette() const
QColor darker(int factor) const
void drawMaximumSlider(QStylePainter *painter) const
void onRangeChanged(int minimum, int maximum)
int right() const
void maximumValueChanged(int max)
void setColorAt(qreal position, const QColor &color)
QStyle * style() const
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
int m_SubclassWidth
Original width between the 2 bounds before any moves.
const QColor & color(ColorGroup group, ColorRole role) const
virtual void mouseMoveEvent(QMouseEvent *ev)
int minimumValue() const
int height() const
int x() const
int y() const
int maximumValue() const
virtual QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const =0
void initStyleOption(QStyleOptionSlider *option) const
QStyle::SubControl m_MinimumSliderSelected
Controls selected ?
Qt::MouseButtons buttons() const
int maximumPosition() const
void update()
int x() const
int y() const
Q_DECLARE_FLAGS(Handles, Handle)
int pixelPosFromRangeValue(int val) const
void maximumPositionChanged(int max)
void drawRect(const QRectF &rectangle)
int pixelPosToRangeValue(int pos) const
Copied verbatim from QSliderPrivate class (see QSlider.cpp)
void setPositions(int min, int max)
void positionsChanged(int min, int max)
void ignore()
Qt::Orientation orientation() const
int top() const
void setPen(const QColor &color)
int left() const
ctkRangeSlider(Qt::Orientation o, QWidget *par=0)
Qt::MouseButton button() const
void setMinimumValue(int min)
ctkRangeSlider *const q_ptr
ctkRangeSliderPrivate(ctkRangeSlider &object)
virtual ~ctkRangeSlider()
virtual void paintEvent(QPaintEvent *ev)
void setBrush(const QBrush &brush)
QPoint center() const
int m_MaximumValue
End points of the range on the Model.
bool contains(const QPoint &point, bool proper) const
void minimumPositionChanged(int min)
int minimum() const
virtual void mousePressEvent(QMouseEvent *ev)
QRect intersected(const QRect &rectangle) const
bool symmetricMoves() const
QRect rect() const
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const
void accept()
void setMinimumPosition(int min)
QColor lighter(int factor) const
bool isMinimumSliderDown() const
QStyle::SubControl m_MaximumSliderSelected
int sliderValueFromPosition(int min, int max, int position, int span, bool upsideDown)
int width() const
int m_MaximumPosition
End points of the range on the GUI. This is synced with the model.
virtual void initMinimumSliderStyleOption(QStyleOptionSlider *option) const
void setSymmetricMoves(bool symmetry)
virtual void mouseReleaseEvent(QMouseEvent *ev)
void triggerAction(SliderAction action)
void adjust(int dx1, int dy1, int dx2, int dy2)
int bottom() const
int sliderPositionFromValue(int min, int max, int logicalValue, int span, bool upsideDown)
void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &option)
bool isMaximumSliderDown() const
void valuesChanged(int min, int max)
Utility signal that is fired when minimum or maximum values have changed.
bool hasTracking() const
virtual SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const =0
const QPoint & pos() const
int maximum() const
void setMaximumValue(int max)
QRect united(const QRect &rectangle) const
bool isSliderDown() const
Q_DECLARE_PUBLIC(ctkRangeSlider)
void setValues(int min, int max)