Kaynağa Gözat

Merge branch 'slider-inverted-properties'

* slider-inverted-properties:
  invertedAppearance and invertedControls properties for ctkDoubleSlider, ctkDoubleSpinBox and ctkSliderWidget

Conflicts:
  ctkDoubleSpinBox.h
  ctkDoubleSpinBox.cpp
Julien Finet 11 yıl önce
ebeveyn
işleme
fe2589a469

+ 4 - 3
Libs/Widgets/CMakeLists.txt

@@ -67,6 +67,8 @@ set(KIT_SRCS
   ctkDoubleRangeSlider.h
   ctkDoubleSlider.cpp
   ctkDoubleSlider.h
+  ctkDoubleSpinBox.cpp
+  ctkDoubleSpinBox.h
   ctkDynamicSpacer.cpp
   ctkDynamicSpacer.h
   ctkErrorLogStatusMessageHandler.cpp
@@ -147,8 +149,6 @@ set(KIT_SRCS
   ctkSizeGrip.h
   ctkSliderWidget.cpp
   ctkSliderWidget.h
-  ctkDoubleSpinBox.cpp
-  ctkDoubleSpinBox.h
   ctkTestApplication.cpp
   ctkTestApplication.h
   ctkThumbnailLabel.cpp
@@ -218,6 +218,8 @@ set(KIT_MOC_SRCS
   ctkDirectoryButton.h
   ctkDoubleRangeSlider.h
   ctkDoubleSlider.h
+  ctkDoubleSpinBox.h
+  ctkDoubleSpinBox_p.h
   ctkDynamicSpacer.h
   ctkErrorLogWidget.h
   ctkErrorLogStatusMessageHandler.h
@@ -257,7 +259,6 @@ set(KIT_MOC_SRCS
   ctkSimpleLayoutManager.h
   ctkSizeGrip.h
   ctkSliderWidget.h
-  ctkDoubleSpinBox.h
   ctkTestApplication.h
   ctkThumbnailLabel.h
   ctkThumbnailListWidget.h

+ 3 - 3
Libs/Widgets/Plugins/CMakeLists.txt

@@ -40,6 +40,8 @@ set(PLUGIN_SRCS
   ctkDoubleRangeSliderPlugin.h
   ctkDoubleSliderPlugin.cpp
   ctkDoubleSliderPlugin.h
+  ctkDoubleSpinBoxPlugin.cpp
+  ctkDoubleSpinBoxPlugin.h
   ctkDynamicSpacerPlugin.cpp
   ctkDynamicSpacerPlugin.h
   ctkExpandButtonPlugin.cpp
@@ -90,8 +92,6 @@ set(PLUGIN_SRCS
   ctkSettingsDialogPlugin.h
   ctkSliderWidgetPlugin.cpp
   ctkSliderWidgetPlugin.h
-  ctkDoubleSpinBoxPlugin.cpp
-  ctkDoubleSpinBoxPlugin.h
   ctkWorkflowButtonBoxWidgetPlugin.cpp
   ctkWorkflowButtonBoxWidgetPlugin.h
   ctkWorkflowWidgetStepPlugin.cpp
@@ -116,6 +116,7 @@ set(PLUGIN_MOC_SRCS
   ctkDirectoryButtonPlugin.h
   ctkDoubleRangeSliderPlugin.h
   ctkDoubleSliderPlugin.h
+  ctkDoubleSpinBoxPlugin.h
   ctkDynamicSpacerPlugin.h
   ctkExpandButtonPlugin.h
   ctkExpandableWidgetPlugin.h
@@ -141,7 +142,6 @@ set(PLUGIN_MOC_SRCS
   ctkSettingsPanelPlugin.h
   ctkSettingsDialogPlugin.h
   ctkSliderWidgetPlugin.h
-  ctkDoubleSpinBoxPlugin.h
   ctkWorkflowButtonBoxWidgetPlugin.h
   ctkWorkflowWidgetStepPlugin.h
   )

+ 2 - 2
Libs/Widgets/Plugins/ctkWidgetsPlugins.h

@@ -40,6 +40,7 @@
 #include "ctkDirectoryButtonPlugin.h"
 #include "ctkDoubleRangeSliderPlugin.h"
 #include "ctkDoubleSliderPlugin.h"
+#include "ctkDoubleSpinBoxPlugin.h"
 #include "ctkDynamicSpacerPlugin.h"
 #include "ctkExpandButtonPlugin.h"
 #include "ctkExpandableWidgetPlugin.h"
@@ -60,7 +61,6 @@
 #include "ctkSettingsPanelPlugin.h"
 #include "ctkSettingsDialogPlugin.h"
 #include "ctkSliderWidgetPlugin.h"
-#include "ctkDoubleSpinBoxPlugin.h"
 #include "ctkThumbnailLabelPlugin.h"
 #include "ctkTransferFunctionViewPlugin.h"
 #include "ctkTreeComboBoxPlugin.h"
@@ -92,6 +92,7 @@ public:
             << new ctkDirectoryButtonPlugin
             << new ctkDoubleRangeSliderPlugin
             << new ctkDoubleSliderPlugin
+            << new ctkDoubleSpinBoxPlugin
             << new ctkDynamicSpacerPlugin
             << new ctkExpandButtonPlugin
             << new ctkExpandableWidgetPlugin
@@ -112,7 +113,6 @@ public:
             << new ctkSettingsPanelPlugin
             << new ctkSettingsDialogPlugin
             << new ctkSliderWidgetPlugin
-            << new ctkDoubleSpinBoxPlugin
             << new ctkThumbnailLabelPlugin
             << new ctkTransferFunctionViewPlugin
             << new ctkTreeComboBoxPlugin

+ 2 - 2
Libs/Widgets/Testing/Cpp/CMakeLists.txt

@@ -29,6 +29,7 @@ set(TEST_SOURCES
   ctkDoubleRangeSliderTest2.cpp
   ctkDoubleSliderTest1.cpp
   ctkDoubleSliderTest2.cpp
+  ctkDoubleSpinBoxTest1.cpp
   ctkDynamicSpacerTest1.cpp
   ctkDynamicSpacerTest2.cpp
   ctkErrorLogWidgetTest1.cpp
@@ -71,7 +72,6 @@ set(TEST_SOURCES
   ctkSignalMapperTest1.cpp
   ctkSliderWidgetTest1.cpp
   ctkSliderWidgetTest2.cpp
-  ctkDoubleSpinBoxTest1.cpp
   ctkThumbnailListWidgetTest1.cpp
   ctkThumbnailLabelTest1.cpp
   ctkToolTipTrapperTest1.cpp
@@ -230,6 +230,7 @@ SIMPLE_TEST( ctkDoubleRangeSliderTest1 )
 SIMPLE_TEST( ctkDoubleRangeSliderTest2 )
 SIMPLE_TEST( ctkDoubleSliderTest1 )
 SIMPLE_TEST( ctkDoubleSliderTest2 )
+SIMPLE_TEST( ctkDoubleSpinBoxTest1 )
 SIMPLE_TEST( ctkDynamicSpacerTest1 )
 SIMPLE_TEST( ctkDynamicSpacerTest2 )
 SIMPLE_TEST( ctkErrorLogWidgetTest1 )
@@ -275,7 +276,6 @@ SIMPLE_TEST( ctkSettingsTest1 )
 SIMPLE_TEST( ctkSignalMapperTest1 )
 SIMPLE_TEST( ctkSliderWidgetTest1 )
 SIMPLE_TEST( ctkSliderWidgetTest2 )
-SIMPLE_TEST( ctkDoubleSpinBoxTest1 )
 SIMPLE_TEST( ctkThumbnailListWidgetTest1 )
 SIMPLE_TEST( ctkThumbnailLabelTest1 )
 SIMPLE_TEST( ctkToolTipTrapperTest1 )

+ 28 - 0
Libs/Widgets/ctkDoubleSlider.cpp

@@ -356,6 +356,34 @@ void ctkDoubleSlider::setTracking(bool enable)
 }
 
 // --------------------------------------------------------------------------
+bool ctkDoubleSlider::invertedAppearance()const
+{
+  Q_D(const ctkDoubleSlider);
+  return d->Slider->invertedAppearance();
+}
+
+// --------------------------------------------------------------------------
+void ctkDoubleSlider::setInvertedAppearance(bool invertedAppearance)
+{
+  Q_D(ctkDoubleSlider);
+  d->Slider->setInvertedAppearance(invertedAppearance);
+}
+
+// --------------------------------------------------------------------------
+bool ctkDoubleSlider::invertedControls()const
+{
+  Q_D(const ctkDoubleSlider);
+  return d->Slider->invertedControls();
+}
+
+// --------------------------------------------------------------------------
+void ctkDoubleSlider::setInvertedControls(bool invertedControls)
+{
+  Q_D(ctkDoubleSlider);
+  d->Slider->setInvertedControls(invertedControls);
+}
+
+// --------------------------------------------------------------------------
 void ctkDoubleSlider::triggerAction( QAbstractSlider::SliderAction action)
 {
   Q_D(ctkDoubleSlider);

+ 23 - 0
Libs/Widgets/ctkDoubleSlider.h

@@ -54,6 +54,8 @@ class CTK_WIDGETS_EXPORT ctkDoubleSlider : public QWidget
   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
   Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
   Q_PROPERTY(QString handleToolTip READ handleToolTip WRITE setHandleToolTip)
+  Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
+  Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
 
 public:
   /// Superclass typedef
@@ -153,6 +155,27 @@ public:
   /// The orientation must be Qt::Vertical (the default) or Qt::Horizontal.
   Qt::Orientation orientation()const;
 
+  /// This property holds whether or not a slider shows its values inverted.
+  /// If this property is false (the default), the minimum and maximum will
+  /// be shown in its classic position for the inherited widget. If the value
+  /// is true, the minimum and maximum appear at their opposite location.
+  /// Note: This property makes most sense for sliders and dials. For scroll
+  /// bars, the visual effect of the scroll bar subcontrols depends on whether
+  /// or not the styles understand inverted appearance; most styles ignore this
+  /// property for scroll bars.
+  /// \sa invertedControls
+  void setInvertedAppearance(bool invertedAppearance);
+  bool invertedAppearance()const;
+
+  /// This property holds whether or not the slider inverts its wheel and key
+  /// events.
+  /// If this property is false, scrolling the mouse wheel "up" and using keys
+  /// like page up will increase the slider's value towards its maximum.
+  /// Otherwise pressing page up will move value towards the slider's minimum.
+  /// \sa invertedAppearance
+  void setInvertedControls(bool invertedControls);
+  bool invertedControls()const;
+
   ///
   /// Controls the text to display for the handle tooltip. It is in addition
   /// to the widget tooltip.

+ 76 - 22
Libs/Widgets/ctkDoubleSpinBox.cpp

@@ -19,14 +19,13 @@
 =========================================================================*/
 
 // CTK includes
-#include "ctkDoubleSpinBox.h"
+#include "ctkDoubleSpinBox_p.h"
 #include "ctkUtils.h"
 #include "ctkPimpl.h"
 
 #include <QDebug>
 
 // Qt includes
-#include <QDoubleSpinBox>
 #include <QEvent>
 #include <QHBoxLayout>
 #include <QKeyEvent>
@@ -34,31 +33,69 @@
 #include <QSizePolicy>
 #include <QVariant>
 
-//-----------------------------------------------------------------------------
-class ctkDoubleSpinBoxPrivate
+//----------------------------------------------------------------------------
+ctkQDoubleSpinBox::ctkQDoubleSpinBox(QWidget* spinBoxParent)
+  : QDoubleSpinBox(spinBoxParent)
 {
-  Q_DECLARE_PUBLIC(ctkDoubleSpinBox);
-protected:
-  ctkDoubleSpinBox* const q_ptr;
-public:
-  ctkDoubleSpinBoxPrivate(ctkDoubleSpinBox& object);
+  this->InvertedControls = false;
+}
+
+//----------------------------------------------------------------------------
+void ctkQDoubleSpinBox::setInvertedControls(bool invertedControls)
+{
+  this->InvertedControls = invertedControls;
+}
+
+//----------------------------------------------------------------------------
+bool ctkQDoubleSpinBox::invertedControls() const
+{
+  return this->InvertedControls;
+}
+
+//----------------------------------------------------------------------------
+void ctkQDoubleSpinBox::stepBy(int steps)
+{
+  if (this->InvertedControls)
+    {
+    steps = -steps;
+    }
+  this->Superclass::stepBy(steps);
+}
+
+//----------------------------------------------------------------------------
+QAbstractSpinBox::StepEnabled ctkQDoubleSpinBox::stepEnabled() const
+{
+  if (!this->InvertedControls)
+    {
+    return this->Superclass::stepEnabled();
+    }
 
-  QDoubleSpinBox* SpinBox;
-  ctkDoubleSpinBox::SetMode Mode;
-  int DefaultDecimals;
-  ctkDoubleSpinBox::DecimalsOptions DOption;
+  if (this->isReadOnly())
+    {
+    return StepNone;
+    }
 
-  void init();
-  // Compare two double previously rounded according to the number of decimals
-  bool compare(double x1, double x2) const;
+  if (this->wrapping())
+    {
+    return StepEnabled(StepUpEnabled | StepDownEnabled);
+    }
 
-  // Set the number of decimals of the spinbox and emit the signal
-  // No check if they are the same.
-  void setDecimals(int dec);
-};
+  StepEnabled ret = StepNone;
+  double value = this->value();
+  if (value < this->maximum())
+    {
+    ret |= StepDownEnabled;
+    }
+  if (value > this->minimum())
+    {
+    ret |= StepUpEnabled;
+    }
+  return ret;
+}
 
 //-----------------------------------------------------------------------------
-ctkDoubleSpinBoxPrivate::ctkDoubleSpinBoxPrivate(ctkDoubleSpinBox& object) : q_ptr(&object)
+ctkDoubleSpinBoxPrivate::ctkDoubleSpinBoxPrivate(ctkDoubleSpinBox& object)
+  : q_ptr(&object)
 {
   qRegisterMetaType<ctkDoubleSpinBox::SetMode>("ctkDoubleSpinBox::SetMode");
   qRegisterMetaType<ctkDoubleSpinBox::DecimalsOptions>("ctkDoubleSpinBox::DecimalsOption");
@@ -66,13 +103,15 @@ ctkDoubleSpinBoxPrivate::ctkDoubleSpinBoxPrivate(ctkDoubleSpinBox& object) : q_p
   this->Mode = ctkDoubleSpinBox::SetIfDifferent;
   this->DefaultDecimals = 2;
   this->DOption = ctkDoubleSpinBox::UseShortcuts;
+  this->InvertedControls = false;
 }
 
 //-----------------------------------------------------------------------------
 void ctkDoubleSpinBoxPrivate::init()
 {
   Q_Q(ctkDoubleSpinBox);
-  this->SpinBox = new QDoubleSpinBox(q);
+  this->SpinBox = new ctkQDoubleSpinBox(q);
+  this->SpinBox->setInvertedControls(this->InvertedControls);
   QObject::connect(this->SpinBox, SIGNAL(valueChanged(double)),
     q, SIGNAL(valueChanged(double)));
   QObject::connect(this->SpinBox, SIGNAL(valueChanged(const QString&)),
@@ -425,6 +464,21 @@ void ctkDoubleSpinBox::setDecimalsOption(ctkDoubleSpinBox::DecimalsOptions optio
   d->DOption = option;
 }
 
+//----------------------------------------------------------------------------
+void ctkDoubleSpinBox::setInvertedControls(bool invertedControls)
+{
+  Q_D(ctkDoubleSpinBox);
+  d->InvertedControls = invertedControls;
+  d->SpinBox->setInvertedControls(d->InvertedControls);
+}
+
+//----------------------------------------------------------------------------
+bool ctkDoubleSpinBox::invertedControls() const
+{
+  Q_D(const ctkDoubleSpinBox);
+  return d->InvertedControls;
+}
+
 //-----------------------------------------------------------------------------
 bool ctkDoubleSpinBox::eventFilter(QObject* obj, QEvent* event)
 {

+ 14 - 0
Libs/Widgets/ctkDoubleSpinBox.h

@@ -59,6 +59,12 @@ class CTK_WIDGETS_EXPORT ctkDoubleSpinBox : public QWidget
   Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
   Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
   Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
+  /// This property controls whether decreasing the value by the mouse
+  /// button or mouse wheel increases the value of the widget, and inverts the
+  /// control similarly in the other way round or not. The property is switched off by
+  /// default.
+  /// \sa invertedControls(), setInvertedControls()
+  Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
 
 public:
 
@@ -180,6 +186,14 @@ public:
   ctkDoubleSpinBox::DecimalsOptions decimalsOption();
   void setDecimalsOption(ctkDoubleSpinBox::DecimalsOptions option);
 
+  /// This property holds whether or not the spin box inverts its wheel and key
+  /// events.
+  /// If this property is false, scrolling the mouse wheel "up" and using keys
+  /// like page up will increase the spinbox's value towards its maximum.
+  /// Otherwise pressing page up will move value towards the slider's minimum.
+  void setInvertedControls(bool invertedControls);
+  bool invertedControls() const;
+
 public Q_SLOTS:
   /// Set the value of the spinbox following the current mode.
   /// \sa setMode(), value(), setValueIfDifferent(), setValueAlways()

+ 83 - 0
Libs/Widgets/ctkDoubleSpinBox_p.h

@@ -0,0 +1,83 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// CTK includes
+#include "ctkDoubleSpinBox.h"
+
+// Qt includes
+#include <QDoubleSpinBox>
+
+
+//-----------------------------------------------------------------------------
+class ctkQDoubleSpinBox: public QDoubleSpinBox
+{
+  Q_OBJECT
+  /// This property controls whether decreasing the value by the mouse
+  /// button or mouse wheel increases the value of the widget, and inverts the
+  /// control similarly in the other way round or not. The property is switched off by
+  /// default.
+  /// \sa invertedControls(), setInvertedControls()
+  Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
+public:
+  typedef QDoubleSpinBox Superclass;
+  ctkQDoubleSpinBox(QWidget* widget);
+  void setInvertedControls(bool invertedControls);
+  bool invertedControls() const;
+
+  /// Overrides QDoubleSpinBox::stepBy(int) and negates the step number if the
+  /// invertedControls property is true.
+  virtual void stepBy(int steps);
+
+protected:
+  /// If the invertedControls property is false (by default) then this function
+  /// behavesLike QDoubleSpinBox::stepEnabled(). If the property is true then
+  /// stepping down is allowed if the value is less then the maximum, and
+  /// stepping up is allowed if the value is greater then the minimum.
+  virtual StepEnabled stepEnabled () const;
+
+  bool InvertedControls;
+private:
+  Q_DISABLE_COPY(ctkQDoubleSpinBox);
+};
+
+//-----------------------------------------------------------------------------
+class ctkDoubleSpinBoxPrivate
+{
+  Q_DECLARE_PUBLIC(ctkDoubleSpinBox);
+protected:
+  ctkDoubleSpinBox* const q_ptr;
+public:
+  ctkDoubleSpinBoxPrivate(ctkDoubleSpinBox& object);
+
+  ctkQDoubleSpinBox* SpinBox;
+  ctkDoubleSpinBox::SetMode Mode;
+  int DefaultDecimals;
+  ctkDoubleSpinBox::DecimalsOptions DOption;
+  bool InvertedControls;
+
+  void init();
+  // Compare two double previously rounded according to the number of decimals
+  bool compare(double x1, double x2) const;
+
+  // Set the number of decimals of the spinbox and emit the signal
+  // No check if they are the same.
+  void setDecimals(int dec);
+
+};

+ 29 - 0
Libs/Widgets/ctkSliderWidget.cpp

@@ -517,6 +517,35 @@ bool ctkSliderWidget::hasTracking()const
   return d->Tracking;
 }
 
+// --------------------------------------------------------------------------
+bool ctkSliderWidget::invertedAppearance()const
+{
+  Q_D(const ctkSliderWidget);
+  return d->Slider->invertedAppearance();
+}
+
+// --------------------------------------------------------------------------
+void ctkSliderWidget::setInvertedAppearance(bool invertedAppearance)
+{
+  Q_D(ctkSliderWidget);
+  d->Slider->setInvertedAppearance(invertedAppearance);
+}
+
+// --------------------------------------------------------------------------
+bool ctkSliderWidget::invertedControls()const
+{
+  Q_D(const ctkSliderWidget);
+  return d->Slider->invertedControls() && d->SpinBox->invertedControls();
+}
+
+// --------------------------------------------------------------------------
+void ctkSliderWidget::setInvertedControls(bool invertedControls)
+{
+  Q_D(ctkSliderWidget);
+  d->Slider->setInvertedControls(invertedControls);
+  d->SpinBox->setInvertedControls(invertedControls);
+}
+
 // -------------------------------------------------------------------------
 ctkSliderWidget::SynchronizeSiblings
 ctkSliderWidget::synchronizeSiblings() const

+ 27 - 3
Libs/Widgets/ctkSliderWidget.h

@@ -36,9 +36,9 @@ class ctkDoubleSpinBox;
 
 /// \ingroup Widgets
 ///
-/// ctkSliderWidget is a wrapper around a ctkDoubleSlider and a QDoubleSpinBox
+/// ctkSliderWidget is a wrapper around a ctkDoubleSlider and a ctkDoubleSpinBox
 /// where the slider value and the spinbox value are synchronized.
-/// \sa ctkRangeWidget, ctkDoubleRangeSlider, QSpinBox
+/// \sa ctkRangeWidget, ctkDoubleRangeSlider, QDoubleSpinBox
 class CTK_WIDGETS_EXPORT ctkSliderWidget : public QWidget
 {
   Q_OBJECT
@@ -58,6 +58,8 @@ class CTK_WIDGETS_EXPORT ctkSliderWidget : public QWidget
   Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
   Q_PROPERTY(bool spinBoxVisible READ isSpinBoxVisible WRITE setSpinBoxVisible);
   Q_PROPERTY(bool popupSlider READ hasPopupSlider WRITE setPopupSlider);
+  Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
+  Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
 
 public:
 
@@ -66,7 +68,7 @@ public:
   /// The slider widget siblings aren't updated and this widget does not update
   /// from its siblings.
   /// SynchronizeWidth:
-  /// The width of the SpinBox is set to the same width of the largest QSpinBox
+  /// The width of the SpinBox is set to the same width of the largest QDoubleSpinBox
   /// of its ctkSliderWidget siblings.
   /// SynchronizeDecimals:
   /// Whenever one of the siblings changes its number of decimals, all its
@@ -194,6 +196,28 @@ public:
   ctkSliderWidget::SynchronizeSiblings synchronizeSiblings() const;
   void setSynchronizeSiblings(ctkSliderWidget::SynchronizeSiblings options);
 
+  /// This property holds whether or not a slider shows its values inverted.
+  /// If this property is false (the default), the minimum and maximum will
+  /// be shown in its classic position for the inherited widget. If the value
+  /// is true, the minimum and maximum appear at their opposite location.
+  /// Note: This property makes most sense for sliders and dials. For scroll
+  /// bars, the visual effect of the scroll bar subcontrols depends on whether
+  /// or not the styles understand inverted appearance; most styles ignore this
+  /// property for scroll bars.
+  /// \sa invertedControls
+  void setInvertedAppearance(bool invertedAppearance);
+  bool invertedAppearance()const;
+
+  /// This property holds whether or not the slider and the spinbox invert
+  /// their wheel and key events.
+  /// If this property is false, scrolling the mouse wheel "up" and using keys
+  /// like page up will increase the value of the slider widget towards its
+  /// maximum. Otherwise, pressing page up will move value towards the minimum.
+  /// The default value of the property is false.
+  /// \sa invertedAppearance
+  void setInvertedControls(bool invertedControls);
+  bool invertedControls()const;
+
   ///
   /// The Spinbox visibility can be controlled using setSpinBoxVisible() and
   /// isSpinBoxVisible().