Skip to content

Commit

Permalink
Add a dual handle range slider widget
Browse files Browse the repository at this point in the history
This widget implements a slider which allows users to set a value
range, with a lower and upper value.
  • Loading branch information
nyalldawson committed Nov 26, 2020
1 parent 8a0973b commit 580ab84
Show file tree
Hide file tree
Showing 5 changed files with 725 additions and 0 deletions.
217 changes: 217 additions & 0 deletions python/gui/auto_generated/qgsrangeslider.sip.in
@@ -0,0 +1,217 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrangeslider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsRangeSlider : QWidget
{
%Docstring
A slider control with two interactive endpoints, for interactive selection of a range of values.

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgsrangeslider.h"
%End
public:

QgsRangeSlider( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsRangeSlider, with the specified ``parent`` widget.
%End

int minimum() const;
%Docstring
Returns the minimum value allowed by the widget.

.. seealso:: :py:func:`setMinimum`

.. seealso:: :py:func:`maximum`
%End

int maximum() const;
%Docstring
Returns the maximum value allowed by the widget.

.. seealso:: :py:func:`setMaximum`

.. seealso:: :py:func:`minimum`
%End

int lowerValue() const;
%Docstring
Returns the lower value for the range selected in the widget.

.. seealso:: :py:func:`upperValue`

.. seealso:: :py:func:`setLowerValue`
%End

int upperValue() const;
%Docstring
Returns the upper value for the range selected in the widget.

.. seealso:: :py:func:`lowerValue`

.. seealso:: :py:func:`setUpperValue`
%End

void setTickPosition( QSlider::TickPosition position );
%Docstring
Sets the ``position`` of the tick marks shown in the widget.

.. seealso:: :py:func:`tickPosition`
%End

QSlider::TickPosition tickPosition() const;
%Docstring
Returns the position of the tick marks shown in the widget.

.. seealso:: :py:func:`setTickPosition`
%End

void setTickInterval( int interval );
%Docstring
Sets the ``interval`` for tick marks shown in the widget.

.. seealso:: :py:func:`tickInterval`
%End

int tickInterval() const;
%Docstring
Returns the interval for tick marks shown in the widget.

.. seealso:: :py:func:`setTickInterval`
%End

void setOrientation( Qt::Orientation orientation );
%Docstring
Sets the ``orientation`` of the slider.

.. seealso:: :py:func:`orientation`
%End

Qt::Orientation orientation() const;
%Docstring
Returns the orientation of the slider.

.. seealso:: :py:func:`setOrientation`
%End

bool invertedAppearance() const;
%Docstring
Returns ``True`` if the slider has its values inverted.

If this property is ``False`` (the default), the minimum and maximum will be shown in its classic
position for the widget. If the value is ``True``, the minimum and maximum appear at their opposite location.

.. seealso:: :py:func:`setInvertedAppearance`
%End

void setInvertedAppearance( bool inverted );
%Docstring
Sets whether the slider has its values ``inverted``.

If this property is ``False`` (the default), the minimum and maximum will be shown in its classic
position for the widget. If the value is ``True``, the minimum and maximum appear at their opposite location.

.. seealso:: :py:func:`setInvertedAppearance`
%End

virtual void paintEvent( QPaintEvent *event );

virtual void mousePressEvent( QMouseEvent *event );

virtual void mouseMoveEvent( QMouseEvent *event );

virtual QSize sizeHint() const;


public slots:

void setMaximum( int maximum );
%Docstring
Sets the ``maximum`` value allowed in the widget.

.. seealso:: :py:func:`maximum`

.. seealso:: :py:func:`setMinimum`
%End

void setMinimum( int minimum );
%Docstring
Sets the ``minimum`` value allowed in the widget.

.. seealso:: :py:func:`minimum`

.. seealso:: :py:func:`setMaximum`
%End

void setRangeLimits( int minimum, int maximum );
%Docstring
Sets the ``minimum`` and ``maximum`` range limits for values allowed in the widget.

.. seealso:: :py:func:`setMinimum`

.. seealso:: :py:func:`setMaximum`
%End

void setLowerValue( int value );
%Docstring
Sets the lower ``value`` for the range currently selected in the widget.

.. seealso:: :py:func:`lowerValue`

.. seealso:: :py:func:`setRange`

.. seealso:: :py:func:`setUpperValue`
%End

void setUpperValue( int value );
%Docstring
Sets the upper ``value`` for the range currently selected in the widget.

.. seealso:: :py:func:`upperValue`

.. seealso:: :py:func:`setRange`

.. seealso:: :py:func:`setLowerValue`
%End

void setRange( int lower, int upper );
%Docstring
Sets the current range selected in the widget.

.. seealso:: :py:func:`setLowerValue`

.. seealso:: :py:func:`setUpperValue`
%End

signals:

void rangeChanged( int minimum, int maximum );
%Docstring
Emitted when the range selected in the widget is changed.
%End

void rangeLimitsChanged( int minimum, int maximum );
%Docstring
Emitted when the limits of values allowed in the widget is changed.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsrangeslider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -171,6 +171,7 @@
%Include auto_generated/qgsproviderguiregistry.sip
%Include auto_generated/qgsproxystyle.sip
%Include auto_generated/qgsquerybuilder.sip
%Include auto_generated/qgsrangeslider.sip
%Include auto_generated/qgsrasterformatsaveoptionswidget.sip
%Include auto_generated/qgsrasterlayersaveasdialog.sip
%Include auto_generated/qgsrasterpyramidsoptionswidget.sip
Expand Down
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -551,6 +551,7 @@ set(QGIS_GUI_SRCS
qgsproviderconnectioncombobox.cpp
qgsproxystyle.cpp
qgsquerybuilder.cpp
qgsrangeslider.cpp
qgsrasterformatsaveoptionswidget.cpp
qgsrasterlayersaveasdialog.cpp
qgsrasterpyramidsoptionswidget.cpp
Expand Down Expand Up @@ -791,6 +792,7 @@ set(QGIS_GUI_HDRS
qgsproviderguiregistry.h
qgsproxystyle.h
qgsquerybuilder.h
qgsrangeslider.h
qgsrasterformatsaveoptionswidget.h
qgsrasterlayersaveasdialog.h
qgsrasterpyramidsoptionswidget.h
Expand Down

0 comments on commit 580ab84

Please sign in to comment.