This widget allows you to use a slider with a lineedit in a Dialog Box. The [min,max] interval is divided by 100 line steps (10 page steps), the slider controling the variation in percentage. More...
#include <SliderTextWidget.h>
Inheritance diagram for camitk::SliderTextWidget:
Collaboration diagram for camitk::SliderTextWidget:Signals | |
| void | valueChanged () |
| Signal emitted when the value has changed (either directly using the slider or when the user pressed return) More... | |
Public Member Functions | |
| double | getValue () const |
| Get the current value. More... | |
| void | init (double min=0.0, double max=100.0, double value=50.0) |
| initialize slider and lineedit with the label, min, max, and current value Default values are min=0, max=100 and current value=50 More... | |
| void | setName (const QString &) |
| set the text label (name of the manipulated data) More... | |
| void | setValue (const double, bool emitValueChanged=false) |
| Update slider and lineedit GUI, emit the valueChanged signal only if the boolean is true (default=no) More... | |
| SliderTextWidget (QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags()) | |
| Default constructor, name is automatically used as the text label. More... | |
| ~SliderTextWidget () override | |
| Destructor. More... | |
Protected Slots | |
| void | returnPressed () |
| when the user press return in the line edit More... | |
| void | textModified (QString) |
| When the user change the text. More... | |
| void | valueChanged (int) |
| Update the value of the lineedit when slider moves. More... | |
Private Member Functions | |
| double | sliderToValue (const int) |
| convert from slider value to double More... | |
| void | updateLineEdit () |
| Update the line edit value. More... | |
| void | updateSlider () |
| update the slider position More... | |
| int | valueToSlider (const double) |
| convert from value to slider More... | |
Private Attributes | |
| QColor | bgColor |
| the line edit bg color More... | |
| QLabel * | label |
| the text label More... | |
| QLineEdit * | lineEdit |
| the line edit More... | |
| double | max |
| the max real value More... | |
| double | min |
| the min real value More... | |
| QSlider * | slider |
| the slider More... | |
| double | value |
| the current value More... | |
This widget allows you to use a slider with a lineedit in a Dialog Box. The [min,max] interval is divided by 100 line steps (10 page steps), the slider controling the variation in percentage.
1 label is used to give the parameter a name (default is objectName())
Your own initialization: in YourDialog class,you can init a SliderTextWidget using setText(..) and init(..).
In line edit, if the value is superior or inferior than the initial bounds, the bounds are automatically updated.
| camitk::SliderTextWidget::SliderTextWidget | ( | QWidget * | parent = nullptr, |
| Qt::WindowFlags | fl = Qt::WindowFlags() |
||
| ) |
Default constructor, name is automatically used as the text label.
|
override |
Destructor.
|
inline |
Get the current value.
| void camitk::SliderTextWidget::init | ( | double | min = 0.0, |
| double | max = 100.0, |
||
| double | value = 50.0 |
||
| ) |
|
protectedslot |
when the user press return in the line edit
References lineEdit.
| void camitk::SliderTextWidget::setName | ( | const QString & | name | ) |
set the text label (name of the manipulated data)
| void camitk::SliderTextWidget::setValue | ( | const double | val, |
| bool | emitValueChanged = false |
||
| ) |
Update slider and lineedit GUI, emit the valueChanged signal only if the boolean is true (default=no)
|
private |
convert from slider value to double
|
protectedslot |
When the user change the text.
|
private |
Update the line edit value.
References slider.
|
private |
update the slider position
|
signal |
Signal emitted when the value has changed (either directly using the slider or when the user pressed return)
|
protectedslot |
Update the value of the lineedit when slider moves.
|
private |
convert from value to slider
|
private |
the line edit bg color
Referenced by init().
|
private |
the text label
|
private |
the line edit
Referenced by init(), and returnPressed().
|
private |
the max real value
|
private |
the min real value
Referenced by init().
|
private |
the slider
Referenced by updateLineEdit().
|
private |
the current value
Referenced by init().