Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Signals | Public Member Functions | Protected Slots | Private Member Functions | Private Attributes | List of all members
camitk::SliderTextWidget Class Reference

This widget allows you to use a slider with a lineedit in a Dialog Box. More...

#include <SliderTextWidget.h>

+ Inheritance 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=0, Qt::WFlags fl=0)
 Default constructor, name is automatically used as the text label. More...
 
 ~SliderTextWidget ()
 Destructor. More...
 

Protected Slots

void returnPressed ()
 when the user press return in the line edit More...
 
void textModified (const 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

camitk::SliderTextWidget::SliderTextWidget ( QWidget *  parent = 0,
Qt::WFlags  fl = 0 
)

Default constructor, name is automatically used as the text label.

camitk::SliderTextWidget::~SliderTextWidget ( )

Destructor.

Member Function Documentation

double camitk::SliderTextWidget::getValue ( ) const
inline

Get the current value.

References value.

void camitk::SliderTextWidget::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

void camitk::SliderTextWidget::returnPressed ( )
protectedslot

when the user press return in the line edit

void camitk::SliderTextWidget::setName ( const QString &  )

set the text label (name of the manipulated data)

void camitk::SliderTextWidget::setValue ( const double  ,
bool  emitValueChanged = false 
)

Update slider and lineedit GUI, emit the valueChanged signal only if the boolean is true (default=no)

double camitk::SliderTextWidget::sliderToValue ( const int  )
private

convert from slider value to double

void camitk::SliderTextWidget::textModified ( const QString &  )
protectedslot

When the user change the text.

void camitk::SliderTextWidget::updateLineEdit ( )
private

Update the line edit value.

void camitk::SliderTextWidget::updateSlider ( )
private

update the slider position

void camitk::SliderTextWidget::valueChanged ( )
signal

Signal emitted when the value has changed (either directly using the slider or when the user pressed return)

void camitk::SliderTextWidget::valueChanged ( int  )
protectedslot

Update the value of the lineedit when slider moves.

int camitk::SliderTextWidget::valueToSlider ( const double  )
private

convert from value to slider

Member Data Documentation

QColor camitk::SliderTextWidget::bgColor
private

the line edit bg color

QLabel* camitk::SliderTextWidget::label
private

the text label

QLineEdit* camitk::SliderTextWidget::lineEdit
private

the line edit

double camitk::SliderTextWidget::max
private

the max real value

double camitk::SliderTextWidget::min
private

the min real value

QSlider* camitk::SliderTextWidget::slider
private

the slider

double camitk::SliderTextWidget::value
private

the current value

Referenced by getValue().


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