Loading [MathJax]/extensions/TeX/AMSsymbols.js
Radium Engine  1.5.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Ra::Gui::Widgets::ControlPanel Class Reference

#include <Gui/Widgets/ControlPanel.hpp>

+ Inheritance diagram for Ra::Gui::Widgets::ControlPanel:
+ Collaboration diagram for Ra::Gui::Widgets::ControlPanel:

Public Member Functions

 ControlPanel (const std::string &name, bool hline=true, QWidget *parent=nullptr)
 
 ControlPanel (const ControlPanel &)=delete
 
ControlPaneloperator= (const ControlPanel &)=delete
 
 ControlPanel (ControlPanel &&)=delete
 
ControlPaneloperator= (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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ControlPanel()

Ra::Gui::Widgets::ControlPanel::ControlPanel ( const std::string &  name,
bool  hline = true,
QWidget *  parent = nullptr 
)
explicit

Constructors and destructor. https://en.cppreference.com/w/cpp/language/rule_of_three

Definition at line 20 of file ControlPanel.cpp.

Member Function Documentation

◆ addButton()

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.

Parameters
nameThe name of the button
callbackThe function to call when the state changed
tooltipThe tooltip text

Definition at line 64 of file ControlPanel.cpp.

◆ addColorInput()

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.

Parameters
nameThe name of the color to choose
callbackThe function to call when the state changed. The color give to the callback is in linearRGB color space.
colorThe initial value of the color, in linearRGB color space.
withAlphaallow to enter alpha channel value
tooltipThe tooltip text

Definition at line 155 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addComboBox()

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

Parameters
nameThe name of the option
callbackThe function to call when the index changed
initialThe initial index of the combobox
itemsThe menu items of the combobox
tooltipThe tooltip text

Definition at line 277 of file ControlPanel.cpp.

◆ addConstrainedNumberInput()

template<typename T >
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.

Template Parameters
TThe type of value to edit (default Scalar)
Parameters
nameThe name of the scalar value
callbackThe function to call when the state changed
initialThe initial value of the scalar
predicatedefines a set of conditions that the scalar should meet
tooltipThe tooltip text
decThe display precision (decimals) of the value

Definition at line 282 of file ControlPanel.hpp.

◆ addFileInput()

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

Parameters
nameThe name of the file property to expose
callbackThe function to call when the state changed
rootDirectoryThe initial directory of the file dialog
filtersThe filters to apply to filenames
tooltipThe tooltip text

Definition at line 208 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addFileOutput()

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

Parameters
nameThe name of the file property to expose
callbackThe function to call when the state changed
rootDirectoryThe initial directory of the file dialog
filtersThe filters to apply to filenames
tooltipThe tooltip text

Definition at line 232 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addLabel()

void Ra::Gui::Widgets::ControlPanel::addLabel ( const std::string &  text)

Add a label. Shows text.

Parameters
textThe text to show

Definition at line 59 of file ControlPanel.cpp.

◆ addMatrixInput()

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.

Parameters
nameThe name of the matrix
callbackThe function to call when the state changed
initialThe initial value of the matrix
decThe display precision (decimals) of the value
tooltipThe tooltip text

Definition at line 135 of file ControlPanel.cpp.

◆ addNumberInput()

template<typename T >
void Ra::Gui::Widgets::ControlPanel::addNumberInput ( const std::string &  name,
std::function< void(T)>  callback,
initial,
min = std::numeric_limits<T>::lowest(),
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.

Template Parameters
TThe type of value to edit (default Scalar)
Parameters
nameThe name of the scalar value
callbackThe function to call when the state changed
initialThe initial value of the scalar
minThe min bound of the value
maxThe max bound of the value
tooltipThe tooltip text
decThe display precision (decimals) of the value

Definition at line 316 of file ControlPanel.hpp.

◆ addOption()

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.

Parameters
nameThe name of the option
callbackThe function to call when the state changed
setThe initial value of the option

Definition at line 43 of file ControlPanel.cpp.

◆ addPowerSliderInput()

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.

Parameters
nameThe name of the scalar value
callbackThe function to call when the state changed
initialThe initial value of the color
minThe min bound of the value
maxThe max bound of the value
decThe display precision (decimals) of the value
tooltipThe tooltip text

Definition at line 111 of file ControlPanel.cpp.

◆ addSeparator()

void Ra::Gui::Widgets::ControlPanel::addSeparator ( )

Add a separator

Definition at line 259 of file ControlPanel.cpp.

◆ addSliderInput()

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.

Parameters
nameThe name of the scalar value
callbackThe function to call when the state changed
initialThe initial value of the scalar
minThe min bound of the value
maxThe max bound of the value
decThe display precision (decimals) of the value
tooltipThe tooltip text

Definition at line 76 of file ControlPanel.cpp.

◆ addStretch()

void Ra::Gui::Widgets::ControlPanel::addStretch ( int  stretch = 0)

Adds a stretchable space to the current layout

Parameters
stretchfactor

Definition at line 324 of file ControlPanel.cpp.

◆ addVectorInput()

template<typename T >
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.

Parameters
nameThe name of the vector
callbackThe function to call when the state changed
initialThe initial value of the vector
decThe display precision (decimals) of the value
tooltipThe tooltip text

Definition at line 351 of file ControlPanel.hpp.

◆ addWidget()

void Ra::Gui::Widgets::ControlPanel::addWidget ( QWidget *  newWidget)

Add an arbitrary widget to the ui.

Parameters
newWidgetThe widget to add to the ui.

Definition at line 328 of file ControlPanel.cpp.

◆ beginLayout()

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

Parameters
dirthe direction of the layout direction could be :
  • QBoxLayout::LeftToRight
  • QBoxLayout::RightToLeft
  • QBoxLayout::TopToBottom
  • QBoxLayout::BottomToTop

Definition at line 247 of file ControlPanel.cpp.

◆ endLayout()

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.

+ Here is the call graph for this function:

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