![]() |
Radium Engine
1.5.0
|
#include <Gui/Widgets/ControlPanel.hpp>
Public Member Functions | |
ControlPanel (const std::string &name, bool hline=true, QWidget *parent=nullptr) | |
ControlPanel (const ControlPanel &)=delete | |
ControlPanel & | operator= (const ControlPanel &)=delete |
ControlPanel (ControlPanel &&)=delete | |
ControlPanel & | operator= (ControlPanel &&)=delete |
void | beginLayout (QBoxLayout::Direction dir=QBoxLayout::LeftToRight) |
void | endLayout (bool separator=false) |
void | addSeparator () |
void | addStretch (int stretch=0) |
void | addOption (const std::string &name, std::function< void(bool)> callback, bool set=false, const std::string &tooltip="") |
void | addLabel (const std::string &text) |
void | addButton (const std::string &name, std::function< void()> callback, const std::string &tooltip="") |
void | addColorInput (const std::string &name, const std::function< void(const Ra::Core::Utils::Color &clr)> &callback, Ra::Core::Utils::Color color=Ra::Core::Utils::Color::Black(), bool withAlpha=true, const std::string &tooltip="") |
template<typename T = Scalar> | |
void | addNumberInput (const std::string &name, std::function< void(T)> callback, T initial, T min=std::numeric_limits< T >::lowest(), T max=std::numeric_limits< T >::max(), const std::string &tooltip="", int dec=3) |
template<typename T = Scalar> | |
void | addConstrainedNumberInput (const std::string &name, std::function< void(T)> callback, Scalar initial, std::function< bool(T)> predicate, const std::string &tooltip="", int dec=3) |
void | addSliderInput (const std::string &name, std::function< void(int)> callback, int initial=0, int min=0, int max=100, const std::string &tooltip="") |
void | addPowerSliderInput (const std::string &name, std::function< void(double)> callback, double initial=0, double min=0, double max=100, const std::string &tooltip="") |
template<typename T = Scalar> | |
void | addVectorInput (const std::string &name, std::function< void(const std::vector< T > &)> callback, const std::vector< T > &initial, const std::string &tooltip="") |
void | addMatrixInput (const std::string &name, std::function< void(const Ra::Core::MatrixN &)> callback, const Ra::Core::MatrixN &initial, int dec=3, const std::string &tooltip="") |
void | addFileInput (const std::string &name, std::function< void(std::string)> callback, const std::string &rootDirectory, const std::string &filters, const std::string &tooltip="") |
void | addFileOutput (const std::string &name, std::function< void(std::string)> callback, const std::string &rootDirectory, const std::string &filters, const std::string &tooltip="") |
void | addComboBox (const std::string &name, std::function< void(int)> callback, int initial, const std::vector< std::string > &items, const std::string &tooltip="") |
void | addComboBox (const std::string &name, std::function< void(const QString &)> callback, const std::string &initial, const std::vector< std::string > &items, const std::string &tooltip="") |
void | addWidget (QWidget *newWidget) |
Simple panel for Qt gui. A control panel will expose all configurable options the bject its decorate to allow the user to interact with it.
Definition at line 25 of file ControlPanel.hpp.
|
explicit |
Constructors and destructor. https://en.cppreference.com/w/cpp/language/rule_of_three
Definition at line 20 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addButton | ( | const std::string & | name, |
std::function< void()> | callback, | ||
const std::string & | tooltip = "" |
||
) |
Add a button. This button, when pressed, will call the associated callback.
name | The name of the button |
callback | The function to call when the state changed |
tooltip | The tooltip text |
Definition at line 64 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addColorInput | ( | const std::string & | name, |
const std::function< void(const Ra::Core::Utils::Color &clr)> & | callback, | ||
Ra::Core::Utils::Color | color = Ra::Core::Utils::Color::Black() , |
||
bool | withAlpha = true , |
||
const std::string & | tooltip = "" |
||
) |
Add a color input button. This button, when pressed, will open a color chooser and call the associated callback. The button is also painted with the chosen color.
name | The name of the color to choose |
callback | The function to call when the state changed. The color give to the callback is in linearRGB color space. |
color | The initial value of the color, in linearRGB color space. |
withAlpha | allow to enter alpha channel value |
tooltip | The tooltip text |
Definition at line 155 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addComboBox | ( | const std::string & | name, |
std::function< void(int)> | callback, | ||
int | initial, | ||
const std::vector< std::string > & | items, | ||
const std::string & | tooltip = "" |
||
) |
Add a combobox to the panel Allow the user to select values from a combobox
name | The name of the option |
callback | The function to call when the index changed |
initial | The initial index of the combobox |
items | The menu items of the combobox |
tooltip | The tooltip text |
Definition at line 277 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addConstrainedNumberInput | ( | const std::string & | name, |
std::function< void(T)> | callback, | ||
Scalar | initial, | ||
std::function< bool(T)> | predicate, | ||
const std::string & | tooltip = "" , |
||
int | dec = 3 |
||
) |
Add a checking scalar (real number) input spinbox. This input will return a scalar value that meet the conditions of a given predicate.
T | The type of value to edit (default Scalar) |
name | The name of the scalar value |
callback | The function to call when the state changed |
initial | The initial value of the scalar |
predicate | defines a set of conditions that the scalar should meet |
tooltip | The tooltip text |
dec | The display precision (decimals) of the value |
Definition at line 282 of file ControlPanel.hpp.
void Ra::Gui::Widgets::ControlPanel::addFileInput | ( | const std::string & | name, |
std::function< void(std::string)> | callback, | ||
const std::string & | rootDirectory, | ||
const std::string & | filters, | ||
const std::string & | tooltip = "" |
||
) |
Add a file dialog to the ui. Allow the user to select a file to load according to given filters
name | The name of the file property to expose |
callback | The function to call when the state changed |
rootDirectory | The initial directory of the file dialog |
filters | The filters to apply to filenames |
tooltip | The tooltip text |
Definition at line 208 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addFileOutput | ( | const std::string & | name, |
std::function< void(std::string)> | callback, | ||
const std::string & | rootDirectory, | ||
const std::string & | filters, | ||
const std::string & | tooltip = "" |
||
) |
Add a save file dialog to the ui. Allow the user to select a file to load according to given filters
name | The name of the file property to expose |
callback | The function to call when the state changed |
rootDirectory | The initial directory of the file dialog |
filters | The filters to apply to filenames |
tooltip | The tooltip text |
Definition at line 232 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addLabel | ( | const std::string & | text | ) |
Add a label. Shows text.
text | The text to show |
Definition at line 59 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addMatrixInput | ( | const std::string & | name, |
std::function< void(const Ra::Core::MatrixN &)> | callback, | ||
const Ra::Core::MatrixN & | initial, | ||
int | dec = 3 , |
||
const std::string & | tooltip = "" |
||
) |
Add a matrix input. This input will return a matrix.
name | The name of the matrix |
callback | The function to call when the state changed |
initial | The initial value of the matrix |
dec | The display precision (decimals) of the value |
tooltip | The tooltip text |
Definition at line 135 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addNumberInput | ( | const std::string & | name, |
std::function< void(T)> | callback, | ||
T | initial, | ||
T | min = std::numeric_limits<T>::lowest() , |
||
T | max = std::numeric_limits<T>::max() , |
||
const std::string & | tooltip = "" , |
||
int | dec = 3 |
||
) |
Add a scalar input spinbox. This input will return a scalar value within given bounds.
T | The type of value to edit (default Scalar) |
name | The name of the scalar value |
callback | The function to call when the state changed |
initial | The initial value of the scalar |
min | The min bound of the value |
max | The max bound of the value |
tooltip | The tooltip text |
dec | The display precision (decimals) of the value |
Definition at line 316 of file ControlPanel.hpp.
void Ra::Gui::Widgets::ControlPanel::addOption | ( | const std::string & | name, |
std::function< void(bool)> | callback, | ||
bool | set = false , |
||
const std::string & | tooltip = "" |
||
) |
Add an option to the panel An option is an on/off checkbox to activate a state of the renderer.
name | The name of the option |
callback | The function to call when the state changed |
set | The initial value of the option |
Definition at line 43 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addPowerSliderInput | ( | const std::string & | name, |
std::function< void(double)> | callback, | ||
double | initial = 0 , |
||
double | min = 0 , |
||
double | max = 100 , |
||
const std::string & | tooltip = "" |
||
) |
Add an horizontal power slider input. This input will return a scalar value within given bounds.
name | The name of the scalar value |
callback | The function to call when the state changed |
initial | The initial value of the color |
min | The min bound of the value |
max | The max bound of the value |
dec | The display precision (decimals) of the value |
tooltip | The tooltip text |
Definition at line 111 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addSeparator | ( | ) |
Add a separator
Definition at line 259 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addSliderInput | ( | const std::string & | name, |
std::function< void(int)> | callback, | ||
int | initial = 0 , |
||
int | min = 0 , |
||
int | max = 100 , |
||
const std::string & | tooltip = "" |
||
) |
Add an horizontal slider input. This input will return a scalar value within given bounds.
name | The name of the scalar value |
callback | The function to call when the state changed |
initial | The initial value of the scalar |
min | The min bound of the value |
max | The max bound of the value |
dec | The display precision (decimals) of the value |
tooltip | The tooltip text |
Definition at line 76 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addStretch | ( | int | stretch = 0 | ) |
Adds a stretchable space to the current layout
stretch | factor |
Definition at line 324 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::addVectorInput | ( | const std::string & | name, |
std::function< void(const std::vector< T > &)> | callback, | ||
const std::vector< T > & | initial, | ||
const std::string & | tooltip = "" |
||
) |
Add a vector input. This input will return a vector.
name | The name of the vector |
callback | The function to call when the state changed |
initial | The initial value of the vector |
dec | The display precision (decimals) of the value |
tooltip | The tooltip text |
Definition at line 351 of file ControlPanel.hpp.
void Ra::Gui::Widgets::ControlPanel::addWidget | ( | QWidget * | newWidget | ) |
Add an arbitrary widget to the ui.
newWidget | The widget to add to the ui. |
Definition at line 328 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::beginLayout | ( | QBoxLayout::Direction | dir = QBoxLayout::LeftToRight | ) |
Methods to populate the panel with dedicated ui elements. Open a box layout to organise the widgets
dir | the direction of the layout direction could be :
|
Definition at line 247 of file ControlPanel.cpp.
void Ra::Gui::Widgets::ControlPanel::endLayout | ( | bool | separator = false | ) |
Close the current layout. When no layout is opened, widgets are arranged vertically into the panel
Definition at line 252 of file ControlPanel.cpp.