Open 3D Engine AzQtComponents API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzQtComponents::Slider Class Referenceabstract

Base class for Slider components. Wraps a CustomSlider to provide additional styling options and functionality. More...

#include <Slider.h>

Inherits QWidget.

Inherited by AzQtComponents::SliderDouble, and AzQtComponents::SliderInt.

Classes

struct  Border
 Style configuration for slider borders. More...
 
struct  Config
 Style configuration for the Slider class. More...
 
struct  GradientSliderConfig
 Style configuration for gradient slider controls. More...
 
struct  SliderConfig
 Style configuration for slider controls. More...
 

Signals

void sliderPressed ()
 Triggered when the user presses the slider handle.
 
void sliderMoved (int position)
 Triggered when the slider handle position changes via dragging.
 
void sliderReleased ()
 Triggered when the user releases the slider handle.
 
void actionTriggered (int action)
 

Public Member Functions

 Slider (QWidget *parent=nullptr)
 
 Slider (Qt::Orientation orientation, QWidget *parent=nullptr)
 
void setOrientation (Qt::Orientation orientation)
 Sets the slider orientation.
 
Qt::Orientation orientation () const
 Gets the slider orientation.
 
void setToolTipOffset (const QPoint &toolTipOffset)
 Sets a custom tooltip offset for this Slider.
 
QPoint toolTipOffset () const
 Gets the tooltip offset for this Slider.
 
void setToolTipOffsetX (int toolTipOffsetX)
 Sets the X component for the tooltip offset for this Slider.
 
int toolTipOffsetX () const
 Gets the X component of the tooltip offset for this Slider.
 
void setToolTipOffsetY (int toolTipOffsetY)
 Sets the Y component for the tooltip offset for this Slider.
 
int toolTipOffsetY () const
 Gets the Y component of the tooltip offset for this Slider.
 
void setToolTipFormatting (const QString &prefix, const QString &postFix)
 
void sliderIsInMoving (bool b)
 Sets the flag that determines whether the handle is being dragged, stopping event detection.
 
bool IsSliderBeingMoved () const
 Returns whether the handle is being dragged.
 
QSize minimumSizeHint () const override
 Returns the recommended minimum size of the underlying QSlider.
 
QSize sizeHint () const override
 Returns the recommended size of the underlying QSlider.
 
void setFocusProxy (QWidget *proxy)
 Exposes the setFocusProxy function from the underlying Slider.
 
QWidget * focusProxy () const
 Exposes the focusProxy function from the underlying Slider.
 
void setTracking (bool enable)
 Exposes the setTracking function from the underlying Slider.
 
bool hasTracking () const
 Exposes the hasTracking function from the underlying Slider.
 

Static Public Member Functions

static void showHoverToolTip (const QString &toolTipText, const QPoint &globalPosition, QSlider *slider, QWidget *toolTipParentWidget, int width, int height, const QPoint &toolTipOffset)
 Shows a hover tooltip with the right positioning on top of a slider.
 
static int valueFromPosition (QSlider *slider, const QPoint &pos, int width, int height, int bottom)
 Returns the slider value at the position specified.
 
static void applyMidPointStyle (Slider *slider)
 
static void initStaticVars (const QPoint &verticalToolTipOffset, const QPoint &horizontalToolTipOffset)
 
static Config loadConfig (QSettings &settings)
 
static Config defaultConfig ()
 Gets the default Slider style configuration.
 

Protected Member Functions

virtual QString hoverValueText (int sliderValue) const =0
 
bool eventFilter (QObject *watched, QEvent *event) override
 
void ShowValueToolTip (int sliderPos)
 

Protected Attributes

CustomSliderm_slider = nullptr
 
QString m_toolTipPrefix
 
QString m_toolTipPostfix
 

Properties

Qt::Orientation orientation
 Orientation of the slider. Horizontal sliders increase left to right, vertical ones are bottom to top.
 
int toolTipOffsetX
 Horizontal offset for the tooltip displaying the value on hover, in pixels.
 
int toolTipOffsetY
 Vertical offset for the tooltip displaying the value on hover, in pixels.
 

Friends

class Style
 

Detailed Description

Base class for Slider components. Wraps a CustomSlider to provide additional styling options and functionality.

Member Function Documentation

◆ actionTriggered

void AzQtComponents::Slider::actionTriggered ( int  action)
signal

Exposes the actionTriggered signal from the underlying QSlider. This signal is triggered when a slider action is executed. Actions are SliderSingleStepAdd, SliderSingleStepSub, SliderPageStepAdd, SliderPageStepSub, SliderToMinimum, SliderToMaximum, and SliderMove.

◆ applyMidPointStyle()

static void AzQtComponents::Slider::applyMidPointStyle ( Slider slider)
static

Applies the "Midpoint" styling to a Slider. "Midpoint" styling shows a tick halfway through the slider, and has the hover lines originate from it.

◆ initStaticVars()

static void AzQtComponents::Slider::initStaticVars ( const QPoint &  verticalToolTipOffset,
const QPoint &  horizontalToolTipOffset 
)
static

Initializes the static variables used by the Slider class.

Parameters
verticalToolTipOffsetOffset for the hover tooltip on sliders with the vertical orientation.
horizontalToolTipOffsetOffset for the hover tooltip on sliders with the horizontal orientation.

◆ loadConfig()

static Config AzQtComponents::Slider::loadConfig ( QSettings &  settings)
static

Sets the Slider style configuration.

Parameters
settingsThe settings object to load the configuration from.
Returns
The new configuration of the Slider.

◆ setToolTipFormatting()

void AzQtComponents::Slider::setToolTipFormatting ( const QString &  prefix,
const QString &  postFix 
)

Apply custom formatting to the hover tooltip.

Parameters
prefixText to prefix to the slider value being hovered (for example, "$10").
postFixText to postfix to the slider value being hovered (for example, "10%").

The documentation for this class was generated from the following file: