DecimalAction
Qualified name: mv::gui::DecimalAction
-
class DecimalAction : public mv::gui::NumericalAction<float>
Decimal action class.
Stores a float value and creates widgets to interact with it
- Author
Thomas Kroes
Public Functions
-
explicit Q_INVOKABLE DecimalAction(QObject *parent, const QString &title, float minimum = INIT_MIN, float maximum = INIT_MAX, float value = INIT_VALUE, std::uint32_t numberOfDecimals = INIT_NUMBER_OF_DECIMALS)
Constructor.
- Parameters:
parent – Pointer to parent object
title – Title of the action
minimum – Minimum value
maximum – Maximum value
value – Value
numberOfDecimals – Number of decimals
-
void initialize(float minimum, float maximum, float value, std::uint32_t numberOfDecimals = INIT_NUMBER_OF_DECIMALS)
Initialize the decimal action.
- Parameters:
minimum – Minimum value
maximum – Maximum value
value – Value
numberOfDecimals – Number of decimals
-
float getSingleStep() const
Gets the single step.
-
void setSingleStep(float singleStep)
Sets the single step.
- Parameters:
singleStep – Single step
-
virtual WidgetAction *getPublicCopy() const override
Get public copy of the action (other compatible actions can connect to it)
- Returns:
Pointer to public copy of the action
-
virtual void fromVariantMap(const QVariantMap &variantMap) override
Load widget action from variant map.
- Parameters:
Variant – map representation of the widget action
-
virtual QVariantMap toVariantMap() const override
Save widget action to variant map.
- Returns:
Variant map representation of the widget action
-
void valueChanged(float value)
Signals that the current value changed.
- Parameters:
value – Current value that changed
-
void minimumChanged(float minimum)
Signals that the minimum value changed.
- Parameters:
minimum – New minimum
-
void maximumChanged(float maximum)
Signals that the maximum value changed.
- Parameters:
maximum – New maximum
-
void prefixChanged(const QString &prefix)
Signals that the prefix changed.
- Parameters:
prefix – New prefix
-
void suffixChanged(const QString &suffix)
Signals that the suffix changed.
- Parameters:
suffix – New suffix
-
void numberOfDecimalsChanged(std::uint32_t numberOfDecimals)
Signals that the number of decimals changed to
numberOfDecimals.- Parameters:
numberOfDecimals – Number of decimals
-
void singleStepChanged(float singleStep)
Signals that the single step changed.
- Parameters:
singleStep – Single step
Protected Functions
-
virtual QWidget *getWidget(QWidget *parent, const std::int32_t &widgetFlags) override
Get widget representation of the decimal action.
- Parameters:
parent – Pointer to parent widget
widgetFlags – Widget flags for the configuration of the widget (type)
-
virtual void connectToPublicAction(WidgetAction *publicAction, bool recursive) override
Connect this action to a public action.
- Parameters:
publicAction – Pointer to public action to connect to
recursive – Whether to also connect descendant child actions
-
virtual void disconnectFromPublicAction(bool recursive) override
Disconnect this action from its public action.
- Parameters:
recursive – Whether to also disconnect descendant child actions
Protected Static Attributes
-
static constexpr float INIT_MIN = 0.0f
Single step size for spin box.
-
static constexpr float INIT_MAX = 100.0f
Initialization minimum value.
-
static constexpr float INIT_VALUE = 0.0
Initialization maximum value.
-
static constexpr int INIT_DECIMALS = 1
Initialization value.
Friends
- friend class AbstractActionsManager
-
class LineEditWidget : public QLineEdit
Line edit widget class for decimal action.
Protected Functions
-
LineEditWidget(QWidget *parent, DecimalAction *decimalAction)
Constructor.
- Parameters:
parent – Pointer to parent widget
decimalAction – Pointer to decimal action
-
LineEditWidget(QWidget *parent, DecimalAction *decimalAction)
-
class SliderWidget : public QSlider
Slider widget class for decimal action.
Protected Functions
-
SliderWidget(QWidget *parent, DecimalAction *decimalAction)
Constructor.
- Parameters:
parent – Pointer to parent widget
decimalAction – Pointer to decimal action
-
SliderWidget(QWidget *parent, DecimalAction *decimalAction)
-
class SpinBoxWidget : public QDoubleSpinBox
Spinbox widget class for decimal action.
Protected Functions
-
SpinBoxWidget(QWidget *parent, DecimalAction *decimalAction)
Constructor.
- Parameters:
parent – Pointer to parent widget
decimalAction – Pointer to decimal action
-
SpinBoxWidget(QWidget *parent, DecimalAction *decimalAction)