23 #include "ginteractor.h" 25 class _Internal_QSlider;
60 GSlider(
int min = 0,
int max = 100,
int value = 50, QWidget* parent =
nullptr);
66 GSlider(
Orientation orientation,
int min = 0,
int max = 100,
int value = 50, QWidget* parent =
nullptr);
80 virtual int getMajorTickSpacing()
const;
85 virtual int getMax()
const;
90 virtual int getMin()
const;
96 virtual int getMinorTickSpacing()
const;
108 virtual bool getPaintLabels()
const;
114 virtual bool getPaintTicks()
const;
121 virtual bool getSnapToTicks()
const;
124 string
getType()
const override;
138 virtual void setMajorTickSpacing(
int value);
144 virtual void setMax(
int max);
150 virtual void setMin(
int min);
156 virtual void setMinorTickSpacing(
int value);
163 virtual void setPaintLabels(
bool value);
169 virtual void setPaintTicks(
bool value);
175 virtual void setRange(
int min,
int max);
182 virtual void setSnapToTicks(
bool value);
188 virtual void setState(
int min,
int max,
int value);
200 string getActionEventType()
const override;
205 _Internal_QSlider* _iqslider;
207 friend class _Internal_QSlider;
214 class _Internal_QSlider :
public QSlider,
public _Internal_QWidget {
218 _Internal_QSlider(
GSlider* qgslider, Qt::Orientation orientation = Qt::Horizontal, QWidget* parent =
nullptr);
219 void detach()
override;
220 void keyPressEvent(QKeyEvent* event)
override;
221 void keyReleaseEvent(QKeyEvent* event)
override;
222 QSize sizeHint()
const override;
225 void handleChange(
int value);
This interactor subclass represents an onscreen slider.
Definition: gslider.h:31
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gslider.cpp:71
static const int DEFAULT_MAX_VALUE
Default maximum value for a slider (100).
Definition: gslider.h:49
virtual void setMax(int max)
Sets the maximum allowed value of the slider.
Definition: gslider.cpp:128
virtual int getMax() const
Returns the maximum allowed value of the slider.
Definition: gslider.cpp:79
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gslider.cpp:110
virtual void setRange(int min, int max)
Sets the min-max range of the slider.
Definition: gslider.cpp:164
virtual Orientation getOrientation() const
Returns the orientation of the slider, either HORIZONTAL or VERTICAL.
Definition: gslider.cpp:91
virtual int getValue() const
Returns the slider's current value.
Definition: gslider.cpp:114
static const int DEFAULT_MIN_VALUE
Default minimum value for a slider (0).
Definition: gslider.h:44
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
virtual void setMin(int min)
Sets the minimum allowed value of the slider.
Definition: gslider.cpp:138
~GSlider() override
Frees memory allocated internally by the slider.
Definition: gslider.cpp:61
static const int DEFAULT_INITIAL_VALUE
Default initial value for a slider (50).
Definition: gslider.h:54
GSlider(int min=0, int max=100, int value=50, QWidget* parent=nullptr)
Creates a new horizontal slider with the given value range.
Definition: gslider.cpp:27
virtual void setState(int min, int max, int value)
Sets all of the relevant state of the slider.
Definition: gslider.cpp:177
virtual void setValue(int value)
Sets the current value of the slider.
Definition: gslider.cpp:190
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gslider.cpp:118
Orientation
The two valid orientations of sliders.
Definition: gslider.h:36
virtual int getMin() const
Returns the minimum allowed value of the slider.
Definition: gslider.cpp:83