Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
Classes | Public Types | Signals | Public Member Functions | List of all members
sv::ParamWidget Class Reference

A convenience widget to enable quickly exposing tunable parameters. More...

#include <sceneview/param_widget.hpp>

Inheritance diagram for sv::ParamWidget:

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)
 

Detailed Description

A convenience widget to enable quickly exposing tunable parameters.

Member Function Documentation

void sv::ParamWidget::AddBoolean ( const QString &  name,
bool  initial_value,
DisplayHint  display_hint 
)

Adds a boolean parameter.

Parameters
nameparameter name.
initial_valuethe initial value of the boolean
display_hintcurrently, 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.

Parameters
to_addA list of boolean parameters to add.
display_hintcurrently, 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.

Parameters
nameparameter name.
minthe minimum value
maxthe maximum value
stepthe increment between valid values
display_hintmust 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.

Parameters
nameparameter name.
itemsthe list of options.
initial_valuethe initially selected option.
display_hintcurrently, 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.

Parameters
nameparameter name.
minthe minimum value
maxthe maximum value
stepthe increment between valid values
display_hintmust 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.

Parameters
namethe 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.

Parameters
namesthe button names.

When any of the buttons are clicked, the ParamChanged() signal is emitted.


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