Explorar o código

Expose the double spinbox to ctkSliderWidget public API

It can be useful to move the spinbox somewhere else, but keeping the
links between the slider and spinbox.
Julien Finet %!s(int64=14) %!d(string=hai) anos
pai
achega
a9f0fb5da2
Modificáronse 2 ficheiros con 15 adicións e 0 borrados
  1. 7 0
      Libs/Widgets/ctkSliderWidget.cpp
  2. 8 0
      Libs/Widgets/ctkSliderWidget.h

+ 7 - 0
Libs/Widgets/ctkSliderWidget.cpp

@@ -494,3 +494,10 @@ void ctkSliderWidget::setSpinBoxVisible(bool visible)
   Q_D(ctkSliderWidget);
   Q_D(ctkSliderWidget);
   d->SpinBox->setVisible(visible);
   d->SpinBox->setVisible(visible);
 }
 }
+
+// --------------------------------------------------------------------------
+QDoubleSpinBox* ctkSliderWidget::spinBox()
+{
+  Q_D(ctkSliderWidget);
+  return d->SpinBox;
+}

+ 8 - 0
Libs/Widgets/ctkSliderWidget.h

@@ -23,6 +23,7 @@
 
 
 // Qt includes
 // Qt includes
 #include <QSlider>
 #include <QSlider>
+class QDoubleSpinBox;
 
 
 // CTK includes
 // CTK includes
 #include <ctkPimpl.h>
 #include <ctkPimpl.h>
@@ -165,6 +166,13 @@ public:
   /// isSpinBoxVisible().
   /// isSpinBoxVisible().
   bool isSpinBoxVisible()const;
   bool isSpinBoxVisible()const;
 
 
+  ///
+  /// Sometimes it can be useful to have a direct control to the spinbox
+  /// To place it somewhere else that ctkDoubleSlider can't. Be careful
+  /// with what you do with the spinbox as ctkDoubleSlider might change
+  /// properties automatically.
+  QDoubleSpinBox* spinBox();
+
 public slots:
 public slots:
   /// 
   /// 
   /// Reset the slider and spinbox to zero (value and position)
   /// Reset the slider and spinbox to zero (value and position)