Radium Engine  1.5.20
Loading...
Searching...
No Matches
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 addSeparator ()
 
void addStretch (int stretch)
 
void newLayout ()
 
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 object its decorate to allow the user to interact with it.

Definition at line 26 of file ControlPanel.hpp.

Constructor & Destructor Documentation

◆ ControlPanel()

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

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 74 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ 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 170 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addComboBox() [1/2]

void Ra::Gui::Widgets::ControlPanel::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 = "" )

Definition at line 297 of file ControlPanel.cpp.

◆ addComboBox() [2/2]

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 274 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ 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 251 of file ControlPanel.hpp.

+ Here is the call graph for this function:

◆ 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 226 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 250 of file ControlPanel.cpp.

◆ addLabel()

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

Add a label. Shows text.

Parameters
textThe text to show

Definition at line 68 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ 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 148 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addNumberInput()

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

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 283 of file ControlPanel.hpp.

+ Here is the call graph for this function:

◆ addOption()

void Ra::Gui::Widgets::ControlPanel::addOption ( const std::string & name,
std::function< void(bool)> callback,
bool set = false,
const std::string & tooltip = "" )

Methods to populate the panel with dedicated ui elements. 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 47 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ 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
tooltipThe tooltip text

Definition at line 123 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addSeparator()

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

Definition at line 265 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
tooltipThe tooltip text

Definition at line 89 of file ControlPanel.cpp.

+ Here is the call graph for this function:

◆ addStretch()

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

Definition at line 321 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
tooltipThe tooltip text

Definition at line 321 of file ControlPanel.hpp.

+ Here is the call graph for this function:

◆ 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.

◆ newLayout()

void Ra::Gui::Widgets::ControlPanel::newLayout ( )
inline

Definition at line 238 of file ControlPanel.hpp.


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