A convenience widget to enable quickly exposing tunable parameters. More...
#include <sceneview/param_widget.hpp>
Classes | |
struct | BoolItem |
Public Types | |
enum | DisplayHint { kComboBox, kCheckBox, kSlider, kSpinBox } |
typedef std::pair< QString, int > | EnumItem |
typedef std::vector< EnumItem > | EnumVector |
Signals | |
void | ParamChanged (const QString &name) |
Public Member Functions | |
ParamWidget (QWidget *parent=nullptr) | |
void | AddEnum (const QString &name, const EnumVector &items, int initial_value, DisplayHint display_hint) |
Adds an enum parameter. More... | |
void | AddBoolean (const QString &name, bool initial_value, DisplayHint display_hint) |
Adds a boolean parameter. More... | |
void | AddBooleans (const std::vector< BoolItem > &to_add, DisplayHint display_hint) |
Adds one or more boolean parameters all in the same row. More... | |
void | AddInt (const QString &name, int min, int max, int step, int initial_value, DisplayHint display_hint) |
Adds an int parameter. More... | |
void | AddDouble (const QString &name, double min, double max, double step, double initial_value, DisplayHint display_hint) |
Adds a double parameter. More... | |
void | AddPushButton (const QString &name) |
Adds a push button. More... | |
void | AddPushButtons (const std::vector< QString > &names) |
Adds one or more push buttons all in the same row. More... | |
void | AddString (const QString &name, const QString &initial_value) |
Add a freeform text entry. | |
int | GetEnum (const QString &name) |
QString | GetEnumString (const QString &name) |
bool | GetBool (const QString &name) |
int | GetInt (const QString &name) |
double | GetDouble (const QString &name) |
QString | GetString (const QString &name) |
void | SetEnum (const QString &name, int val) |
void | SetBool (const QString &name, bool val) |
void | SetInt (const QString &name, int val) |
void | SetDouble (const QString &name, double val) |
void | SetString (const QString &name, const QString &val) |
void | SetPrecision (const QString &name, int digits, int decimal_places) |
void | SetEnabled (const QString &name, bool enabled) |
QVariant | SaveState () |
void | LoadState (const QVariant &variant) |
A convenience widget to enable quickly exposing tunable parameters.
void sv::ParamWidget::AddBoolean | ( | const QString & | name, |
bool | initial_value, | ||
DisplayHint | display_hint | ||
) |
Adds a boolean parameter.
name | parameter name. |
initial_value | the initial value of the boolean |
display_hint | currently, must be ParamWidget::kCheckBox |
When the value of the parameter changes, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddBooleans | ( | const std::vector< BoolItem > & | to_add, |
DisplayHint | display_hint | ||
) |
Adds one or more boolean parameters all in the same row.
to_add | A list of boolean parameters to add. |
display_hint | currently, must be ParamWidget::kCheckBox |
The difference between calling AddBooleans() and calling AddBoolean() multiple times is that all of the parameters passed this method will be displayed on the same row if possible in the parameter widget. When calling AddBoolean() multiple times, each parameter is allocated a new row.
When the value of any of the parameters changes, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddDouble | ( | const QString & | name, |
double | min, | ||
double | max, | ||
double | step, | ||
double | initial_value, | ||
DisplayHint | display_hint | ||
) |
Adds a double parameter.
name | parameter name. |
min | the minimum value |
max | the maximum value |
step | the increment between valid values |
display_hint | must be either ParamWidget::kSlider or ParamWidget::kSpinBox |
When the value of the parameter changes, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddEnum | ( | const QString & | name, |
const EnumVector & | items, | ||
int | initial_value, | ||
DisplayHint | display_hint | ||
) |
Adds an enum parameter.
name | parameter name. |
items | the list of options. |
initial_value | the initially selected option. |
display_hint | currently, must be ParamWidget::kComboBox. |
When the value of the parameter changes, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddInt | ( | const QString & | name, |
int | min, | ||
int | max, | ||
int | step, | ||
int | initial_value, | ||
DisplayHint | display_hint | ||
) |
Adds an int parameter.
name | parameter name. |
min | the minimum value |
max | the maximum value |
step | the increment between valid values |
display_hint | must be either ParamWidget::kSlider or ParamWidget::kSpinBox |
When the value of the parameter changes, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddPushButton | ( | const QString & | name | ) |
Adds a push button.
name | the button name. |
When the button is clicked, the ParamChanged() signal is emitted.
void sv::ParamWidget::AddPushButtons | ( | const std::vector< QString > & | names | ) |
Adds one or more push buttons all in the same row.
names | the button names. |
When any of the buttons are clicked, the ParamChanged() signal is emitted.