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

#include <SpinBox.h>

Inherits QSpinBox.

Classes

struct  Config
 Style configuration for the SpinBox class. More...
 

Signals

void valueChangeBegan ()
 Triggered when the value begins changing, for example when the control starts being dragged.
 
void valueChangeEnded ()
 Triggered when the value stops changing, for example when the control is released.
 
void globalUndoTriggered ()
 Triggered when the global undo key sequence is pressed by the user while this control is focused.
 
void globalRedoTriggered ()
 Triggered when the global redo key sequence is pressed by the user while this control is focused.
 
void cutTriggered ()
 Triggered when the Cut key sequence is pressed by the user while this control is focused.
 
void copyTriggered ()
 Triggered when the Copy key sequence is pressed by the user while this control is focused.
 
void pasteTriggered ()
 Triggered when the Paste key sequence is pressed by the user while this control is focused.
 
void deleteTriggered ()
 Triggered when the Delete key sequence is pressed by the user while this control is focused.
 
void contextMenuAboutToShow (QMenu *menu, QAction *undoAction, QAction *redoAction)
 

Public Member Functions

 SpinBox (QWidget *parent=nullptr)
 
void setValue (int value)
 
QSize minimumSizeHint () const override
 Returns the recommended minimum size for this control.
 
bool isUndoAvailable () const
 Returns whether an undo value is available.
 
bool isRedoAvailable () const
 Returns whether a redo value is available.
 
void setInitialValueWasSetting (bool b)
 Sets whether the initial value was initialized. False prompts reinitialization.
 

Static Public Member Functions

static Config loadConfig (QSettings &settings)
 
static Config defaultConfig ()
 Gets the default SpinBox style configuration.
 
static void setHasError (QAbstractSpinBox *spinbox, bool hasError)
 Sets the "HasError" property of the spinbox, displaying it with a red border.
 

Static Public Attributes

static unsigned int s_watcherReferenceCount
 

Protected Member Functions

void focusInEvent (QFocusEvent *e) override
 
void focusOutEvent (QFocusEvent *e) override
 
void contextMenuEvent (QContextMenuEvent *ev) override
 
virtual void setLastValue (int v)
 

Static Protected Member Functions

static AZ_POP_DISABLE_WARNING void initializeWatcher ()
 
static void uninitializeWatcher ()
 
static bool drawSpinBox (const QProxyStyle *style, const QStyleOption *option, QPainter *painter, const QWidget *widget, const Config &config)
 
static QRect editFieldRect (const QProxyStyle *style, const QStyleOptionComplex *option, const QWidget *widget, const Config &config)
 
static bool polish (QProxyStyle *style, QWidget *widget, const Config &config)
 
static bool unpolish (QProxyStyle *style, QWidget *widget, const Config &config)
 
static void setButtonSymbolsForStyle (QAbstractSpinBox *spinBox)
 

Protected Attributes

internal::SpinBoxLineEditm_lineEdit = nullptr
 
int m_lastValue = 0
 
QString m_lastSuffix
 
QSize m_lastMinimumSize
 

Static Protected Attributes

static QPointer< SpinBoxWatcher > s_spinBoxWatcher
 

Properties

bool undoAvailable
 Whether an undo value is available.
 
bool redoAvailable
 Whether a redo value is available.
 

Friends

class SpinBoxWatcher
 
class Style
 
class VectorElement
 
class DoubleSpinBox
 

Detailed Description

Control for integer number selection. Supports value editing via direct input, dragging, mouse scrollwheel and UI arrows.

Member Function Documentation

◆ contextMenuAboutToShow

void AzQtComponents::SpinBox::contextMenuAboutToShow ( QMenu *  menu,
QAction *  undoAction,
QAction *  redoAction 
)
signal

Triggered before the context menu is shown. Connect to this signal in the main UI thread, with a direct connection. Do not use Qt::QueuedConnection or Qt::BlockingQueuedConnection as the parameters will only be valid for a short time

◆ loadConfig()

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

Sets the SpinBox style configuration.

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

◆ setValue()

void AzQtComponents::SpinBox::setValue ( int  value)

Sets the value of the SpinBox, with undo/redo support. Note that this is an override to a non-virtual function, so an explicit pointer to the SpinBox class must be used in place of QSpinBox for this to work properly.


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