CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Friends | List of all members
ctkDoubleSpinBox Class Reference

Custom SpinBox The ctkDoubleSpinBox internaly uses a QDoubleSpinBox while it retain controls over it. More...

#include <Libs/Widgets/ctkDoubleSpinBox.h>

Inheritance diagram for ctkDoubleSpinBox:
Inheritance graph
[legend]
Collaboration diagram for ctkDoubleSpinBox:
Collaboration graph
[legend]

Public Types

enum  DecimalsOption {
  FixedDecimals = 0x000 , DecimalsByShortcuts = 0x001 , DecimalsByKey = 0x002 , DecimalsByValue = 0x004 ,
  InsertDecimals = 0x008 , ReplaceDecimals = 0x010 , DecimalsAsMax = 0x020 , DecimalsAsMin = 0x040 ,
  DecimalPointAlwaysVisible = 0x080
}
 
enum  SetMode { SetAlways , SetIfDifferent }
 
enum  SizeHintPolicy { SizeHintByMinMax , SizeHintByValue }
 
typedef QWidget Superclass
 

Public Slots

void setDecimals (int decimal)
 
void setValue (double value)
 
void setValueAlways (double value)
 
void setValueIfDifferent (double value)
 
void stepDown ()
 
void stepUp ()
 

Signals

void decimalsChanged (int)
 Signal emitted when the decimals of the displayed are changed. More...
 
void editingFinished ()
 
void valueChanged (const QString &)
 
void valueChanged (double)
 

Public Member Functions

Qt::Alignment alignment () const
 Set/Get the spinbox alignement. More...
 
QString cleanText () const
 
 ctkDoubleSpinBox (ctkDoubleSpinBox::SetMode mode, QWidget *parent=0)
 
 ctkDoubleSpinBox (QWidget *parent=0)
 
int decimals () const
 
ctkDoubleSpinBox::DecimalsOptions decimalsOption ()
 
double displayedValue () const
 
bool hasFrame () const
 
bool invertedControls () const
 
QLineEdit * lineEdit () const
 
double maximum () const
 
double minimum () const
 Set/Get the range of the spinbox. Default range is [0.0, 9.9]. More...
 
virtual QSize minimumSizeHint () const
 
QString prefix () const
 
double round (double value) const
 
void setAlignment (Qt::Alignment flag)
 
void setDecimalsOption (ctkDoubleSpinBox::DecimalsOptions option)
 
void setDisplayedValue (double displayValue)
 
void setFrame (bool frame)
 Set/Get the frame. More...
 
void setInvertedControls (bool invertedControls)
 
void setMaximum (double max)
 
void setMinimum (double min)
 
ctkDoubleSpinBox::SetMode setMode () const
 Set the spinbox mode when using a set*() method. /. More...
 
void setPrefix (const QString &prefix)
 
void setRange (double min, double max)
 
void setSetMode (SetMode mode)
 
void setSingleStep (double value)
 
void setSizeHintPolicy (SizeHintPolicy newSizeHintPolicy)
 
void setSuffix (const QString &suffix)
 
void setValueProxy (ctkValueProxy *proxy)
 
double singleStep () const
 
virtual QSize sizeHint () const
 
SizeHintPolicy sizeHintPolicy () const
 
QDoubleSpinBox * spinBox () const
 
QString suffix () const
 
QString text () const
 
double value () const
 
ctkValueProxyvalueProxy () const
 
virtual ~ctkDoubleSpinBox ()
 

Protected Member Functions

virtual bool eventFilter (QObject *obj, QEvent *event)
 Reimplemented to support shortcuts on the double spinbox. More...
 
virtual void keyPressEvent (QKeyEvent *event)
 Reimplemented to support shortcuts. More...
 

Protected Attributes

ctkDoubleSpinBoxPrivate *const d_ptr
 

Properties

Qt::Alignment alignment
 
QString cleanText
 
int decimals
 
DecimalsOptions decimalsOption
 
bool frame
 
bool invertedControls
 
double maximum
 
double minimum
 
QString prefix
 
SetMode setMode
 
double singleStep
 
SizeHintPolicy sizeHintPolicy
 
QString suffix
 
double value
 

Friends

class ctkCoordinatesWidgetPrivate
 

Detailed Description

Custom SpinBox The ctkDoubleSpinBox internaly uses a QDoubleSpinBox while it retain controls over it.

See also
ctkDoubleSlider, ctkSliderWidget, ctkRangeSlider

Definition at line 45 of file ctkDoubleSpinBox.h.

Member Typedef Documentation

◆ Superclass

Definition at line 160 of file ctkDoubleSpinBox.h.

Member Enumeration Documentation

◆ DecimalsOption

DecimalsOption enums the input style of the spinbox decimals. Default option is DecimalsByShortcuts.

See also
decimals(), currentDecimals()
Enumerator
FixedDecimals 

Behaves just like a QDoubleSpinBox. The maximum number of decimals allowed is given by decimals().

DecimalsByShortcuts 

When the spinbox has focus, entering the shortcut "CTRL +" adds decimals to the current number of decimals. "CTRL -" decreases the number of decimals and "CTRL 0" returns it to its original decimals() value.

DecimalsByKey 

Allow the number of decimals to be controlled by adding/removing digits with key strokes.

See also
InsertDecimals, ReplaceDecimals
DecimalsByValue 

Allow the number of decimals to be controlled by the value set by setValue().

InsertDecimals 

This flag controls whether inserted intermediate decimals increase the number of decimals (on) or not (off). It is incompatible with the ReplaceDecimals flag.

See also
DecimalsByKey.
ReplaceDecimals 

This flag controls whether inserted intermediate decimals replace the existing decimals (on) or not (off). This is similar to Insert but just for decimal digits. It is incompatible with the InsertDecimals flag.

See also
DecimalsByKey, InsertDecimals
DecimalsAsMax 

Use the "decimals" property as a maximum limit for the number of decimals.

DecimalsAsMin 

Use the "decimals" property as a minimum limit for the number of decimals.

DecimalPointAlwaysVisible 

Even if the number of decimals is 0, it enforces the decimal to be visible (e.g. "0." )

See also
decimals

Definition at line 113 of file ctkDoubleSpinBox.h.

◆ SetMode

SetMode enums for the spinbox behavior. SetAlways: No check is made and the given parameters is directly set on the internal QDoubleSpinBox. SetIfDifferent: Default mode, the given parameter is checked agains the current internal value and only set if they are different. For double, the comparison is based on the input parameters rounded with the current number of decimals (see round()).

See also
setMode(), setSetMode(), round()
Enumerator
SetAlways 
SetIfDifferent 

Definition at line 104 of file ctkDoubleSpinBox.h.

◆ SizeHintPolicy

Enumerator
SizeHintByMinMax 
SizeHintByValue 

Definition at line 154 of file ctkDoubleSpinBox.h.

Constructor & Destructor Documentation

◆ ctkDoubleSpinBox() [1/2]

ctkDoubleSpinBox::ctkDoubleSpinBox ( QWidget *  parent = 0)
explicit

Constructor, creates a ctkDoubleSpinBox. The look and feel are the same as of a QDoubleSpinBox

◆ ctkDoubleSpinBox() [2/2]

ctkDoubleSpinBox::ctkDoubleSpinBox ( ctkDoubleSpinBox::SetMode  mode,
QWidget *  parent = 0 
)
explicit

◆ ~ctkDoubleSpinBox()

virtual ctkDoubleSpinBox::~ctkDoubleSpinBox ( )
virtual

Member Function Documentation

◆ alignment()

Qt::Alignment ctkDoubleSpinBox::alignment ( ) const

Set/Get the spinbox alignement.

◆ cleanText()

QString ctkDoubleSpinBox::cleanText ( ) const

Get the spinbox current text. This excludes any prefix or suffix.

See also
value()

◆ decimals()

int ctkDoubleSpinBox::decimals ( ) const

Set/Get number of displayed decimals. For a spinbox dealing only with integers, set this to 0.

See also
ctkDoubleSpinBox::DecimalsOption

◆ decimalsChanged

void ctkDoubleSpinBox::decimalsChanged ( int  )
signal

Signal emitted when the decimals of the displayed are changed.

◆ decimalsOption()

ctkDoubleSpinBox::DecimalsOptions ctkDoubleSpinBox::decimalsOption ( )

Set/Get the option used to input the decimals.

See also
ctkDoubleSpinBox::DecimalsOption

◆ displayedValue()

double ctkDoubleSpinBox::displayedValue ( ) const

Get the spinbox current displayed value

See also
value(), cleanText(), setValue(), displayedValue()

◆ editingFinished

void ctkDoubleSpinBox::editingFinished ( )
signal

Simple broadcast of the QAbstractSpinbox::editingFinished

See also
QAbstractSpinbox::editingFinished

◆ eventFilter()

virtual bool ctkDoubleSpinBox::eventFilter ( QObject *  obj,
QEvent *  event 
)
protectedvirtual

Reimplemented to support shortcuts on the double spinbox.

◆ hasFrame()

bool ctkDoubleSpinBox::hasFrame ( ) const

◆ invertedControls()

bool ctkDoubleSpinBox::invertedControls ( ) const

◆ keyPressEvent()

virtual void ctkDoubleSpinBox::keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Reimplemented to support shortcuts.

◆ lineEdit()

QLineEdit* ctkDoubleSpinBox::lineEdit ( ) const

Get a pointer on the line edit of the spinbox.

See also
QLineEdit, spinBox()

◆ maximum()

double ctkDoubleSpinBox::maximum ( ) const

◆ minimum()

double ctkDoubleSpinBox::minimum ( ) const

Set/Get the range of the spinbox. Default range is [0.0, 9.9].

◆ minimumSizeHint()

virtual QSize ctkDoubleSpinBox::minimumSizeHint ( ) const
virtual

Reimplemented to respect the sizeHintPolicy property value.

See also
sizeHintPolicy

◆ prefix()

QString ctkDoubleSpinBox::prefix ( ) const

Add/Get a prefix to the displayed value. For example, one might want to add the $ sign.

See also
suffix(), text()

◆ round()

double ctkDoubleSpinBox::round ( double  value) const

Returns the rounded value according to the number of decimals of the spinbox.

See also
decimals()

◆ setAlignment()

void ctkDoubleSpinBox::setAlignment ( Qt::Alignment  flag)

◆ setDecimals

void ctkDoubleSpinBox::setDecimals ( int  decimal)
slot

Set the decimals property value.

See also
decimals

◆ setDecimalsOption()

void ctkDoubleSpinBox::setDecimalsOption ( ctkDoubleSpinBox::DecimalsOptions  option)

◆ setDisplayedValue()

void ctkDoubleSpinBox::setDisplayedValue ( double  displayValue)

Set the displayed value if there is no proxy installed. If there is a proxy installed, then it allows to modify the proxy value. If there is no value proxy installed, then it's just a setter to the value property.

See also
displayedValue(), setValue(), value(), setValueProxy()

◆ setFrame()

void ctkDoubleSpinBox::setFrame ( bool  frame)

Set/Get the frame.

◆ setInvertedControls()

void ctkDoubleSpinBox::setInvertedControls ( bool  invertedControls)

This property holds whether or not the spin box inverts its wheel and key events. If this property is false, scrolling the mouse wheel "up" and using keys like page up will increase the spinbox's value towards its maximum. Otherwise pressing page up will move value towards the slider's minimum.

◆ setMaximum()

void ctkDoubleSpinBox::setMaximum ( double  max)

◆ setMinimum()

void ctkDoubleSpinBox::setMinimum ( double  min)

◆ setMode()

ctkDoubleSpinBox::SetMode ctkDoubleSpinBox::setMode ( ) const

Set the spinbox mode when using a set*() method. /.

See also
round(), setValue(), setValueIfDifferent(), setValueAlways()

◆ setPrefix()

void ctkDoubleSpinBox::setPrefix ( const QString &  prefix)

◆ setRange()

void ctkDoubleSpinBox::setRange ( double  min,
double  max 
)

◆ setSetMode()

void ctkDoubleSpinBox::setSetMode ( SetMode  mode)

◆ setSingleStep()

void ctkDoubleSpinBox::setSingleStep ( double  value)

◆ setSizeHintPolicy()

void ctkDoubleSpinBox::setSizeHintPolicy ( SizeHintPolicy  newSizeHintPolicy)

Set the sizeHintPolicy property value.

See also
sizeHintPolicy

◆ setSuffix()

void ctkDoubleSpinBox::setSuffix ( const QString &  suffix)

◆ setValue

void ctkDoubleSpinBox::setValue ( double  value)
slot

Set the value of the spinbox following the current mode.

See also
setMode(), value(), setValueIfDifferent(), setValueAlways()

◆ setValueAlways

void ctkDoubleSpinBox::setValueAlways ( double  value)
slot

Set the value of the spinbox following the SetAlways mode.

See also
value(), setValue(), setMode(), setValueIfDifferent()

◆ setValueIfDifferent

void ctkDoubleSpinBox::setValueIfDifferent ( double  value)
slot

Set the value of the spinbox followin the SetIfDifferent mode.

See also
value(), setValue(), setMode(), setValueAlways()

◆ setValueProxy()

void ctkDoubleSpinBox::setValueProxy ( ctkValueProxy proxy)

Install or remove a value proxy filter. The value proxy decouples the displayed value from the value retrieved by the value property. For example, the value proxy can allow one to display celsius in the spinbox while the value retrieved from the value property and signals are in farenheit. To remove the proxy, simply install a new empty proxy. The proxy installation/removal is silent.

See also
installValueProxy(), valueProxy()

◆ singleStep()

double ctkDoubleSpinBox::singleStep ( ) const

Set/Get the single step. This represents by how much the value will decrease or increase when clicking the spinbox arrow or using stepUp or stepDown(). Default is 1.0.

See also
setUp(), stepDown(), setDecimals().

◆ sizeHint()

virtual QSize ctkDoubleSpinBox::sizeHint ( ) const
virtual

Reimplemented to respect the sizeHintPolicy property value.

See also
sizeHintPolicy

◆ sizeHintPolicy()

SizeHintPolicy ctkDoubleSpinBox::sizeHintPolicy ( ) const

Return the sizeHintPolicy property value.

See also
sizeHintPolicy

◆ spinBox()

QDoubleSpinBox* ctkDoubleSpinBox::spinBox ( ) const

Get a pointer on the spinbox used internally. It can be useful to change display properties for example. To use with caution.

See also
QDoubleSpinBox, lineEdit()

◆ stepDown

void ctkDoubleSpinBox::stepDown ( )
slot

◆ stepUp

void ctkDoubleSpinBox::stepUp ( )
slot

Increase/Decrease the current value by a single step.

See also
value(), singleStep()

◆ suffix()

QString ctkDoubleSpinBox::suffix ( ) const

Add/Get a suffix to the displayed value. For example, one might want to add the F (fahrenheit) sign.

See also
prefix(), text()

◆ text()

QString ctkDoubleSpinBox::text ( ) const

Get the spinbox current text. This includes any prefix or suffix.

See also
prefix(), suffix()

◆ value()

double ctkDoubleSpinBox::value ( ) const

Get the spinbox current value

See also
setValue(), cleanText()

◆ valueChanged [1/2]

void ctkDoubleSpinBox::valueChanged ( const QString &  )
signal

◆ valueChanged [2/2]

void ctkDoubleSpinBox::valueChanged ( double  )
signal

Emitted everytime the spinbox value is modified

See also
QDoubleSpinBox::valueChanged()

◆ valueProxy()

ctkValueProxy* ctkDoubleSpinBox::valueProxy ( ) const

Friends And Related Function Documentation

◆ ctkCoordinatesWidgetPrivate

friend class ctkCoordinatesWidgetPrivate
friend

Definition at line 330 of file ctkDoubleSpinBox.h.

Member Data Documentation

◆ d_ptr

ctkDoubleSpinBoxPrivate* const ctkDoubleSpinBox::d_ptr
protected

Definition at line 323 of file ctkDoubleSpinBox.h.

Property Documentation

◆ alignment

Qt::Alignment ctkDoubleSpinBox::alignment
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ cleanText

QString ctkDoubleSpinBox::cleanText
read

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ decimals

int ctkDoubleSpinBox::decimals
readwrite

This property holds the precision of the spin box, in decimals. Sets how many decimals the spinbox will use for displaying and interpreting doubles. If the flag DecimalsByShortcuts is set, decimals can be increased/decreased by Ctrl+/Ctrl-, Ctrl0 restores the original decimals value. If the flag DecimalsAsMax and/or DecimalsAsMin are set, decimals behave also as the max and/or min number of decimals settable by DecimalsByShortcuts, DecimalsByKey and DecimalsByValue. 2 by default.

See also
decimalsOption, decimals(), setDecimals(), decimalsChanged

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ decimalsOption

DecimalsOptions ctkDoubleSpinBox::decimalsOption
readwrite

This property provides more controls over the decimals. The default (DecimalsByShortcuts|InsertDecimals) behaves as a QDoubleSpinbox with an explicit control of decimals via shortcuts.

See also
DecimalsOptions, decimals

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ frame

bool ctkDoubleSpinBox::frame
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ invertedControls

bool ctkDoubleSpinBox::invertedControls
readwrite

This property controls whether decreasing the value by the mouse button or mouse wheel increases the value of the widget, and inverts the control similarly in the other way round or not. The property is switched off by default.

See also
invertedControls(), setInvertedControls()

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ maximum

double ctkDoubleSpinBox::maximum
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ minimum

double ctkDoubleSpinBox::minimum
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ prefix

QString ctkDoubleSpinBox::prefix
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ setMode

SetMode ctkDoubleSpinBox::setMode
readwrite

This property controls how setValue behaves.

See also
SetMode, setMode(), setSetMode(), value

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ singleStep

double ctkDoubleSpinBox::singleStep
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ sizeHintPolicy

SizeHintPolicy ctkDoubleSpinBox::sizeHintPolicy
readwrite

This property controls the size hint of the spinbox. SizeHintByMinMax by default SizeHintPolicy, sizeHintPolicy(), setSizeHintPolicy()

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ suffix

QString ctkDoubleSpinBox::suffix
readwrite

Definition at line 1 of file ctkDoubleSpinBox.h.

◆ value

double ctkDoubleSpinBox::value
readwrite
See also
setMode, decimals

Definition at line 1 of file ctkDoubleSpinBox.h.


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