Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Slots | Public Member Functions | Protected Slots | Protected Attributes
qMRMLSpinBox Class Reference

Extend the ctkDoubleSpinBox to integrate units support. More...

#include <Libs/MRML/Widgets/qMRMLSpinBox.h>

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

Public Types

typedef ctkDoubleSpinBox Superclass
 
enum  UnitAwareProperty {
  None = 0x00, Prefix = 0x01, Suffix = 0x02, Precision = 0x04,
  MinimumValue = 0x08, MaximumValue = 0x10, Scaling = 0x20
}
 

Properties

QString quantity
 
UnitAwareProperties unitAwareProperties
 

Public Slots

virtual void setMRMLScene (vtkMRMLScene *scene)
 
void setQuantity (const QString &baseName)
 
void setUnitAwareProperties (UnitAwareProperties flags)
 

Public Member Functions

Q_INVOKABLE vtkMRMLScenemrmlScene () const
 
 qMRMLSpinBox (QWidget *parent=nullptr)
 Construct an empty qMRMLSpinBox with a null scene. More...
 
QString quantity () const
 
UnitAwareProperties unitAwareProperties () const
 
 ~qMRMLSpinBox () override
 

Protected Slots

void updateWidgetFromUnitNode ()
 

Protected Attributes

QScopedPointer< qMRMLSpinBoxPrivate > d_ptr
 

Detailed Description

Extend the ctkDoubleSpinBox to integrate units support.

This custom widgets extends the ctkDoubleSpinBox widget to integrate the unit support within Slicer. By default, this widget behaves just like a normal ctkDoubleSpinBox.

To use the units, one needs to set what kind of quantity this widget should look for. For example, when dealing with world positions, the quantity is probably going to be "length". Once a scene is set to this widget, it listens to the changes made upon the selection node to extract the unit properties related to its quantity and update accordingly.

To allow even more customisation, one can set which properties of the spinbox are updated by units and which aren't.

See also
qMRMLSliderWidget, qMRMLCoordinatesWidget

Definition at line 55 of file qMRMLSpinBox.h.

Member Typedef Documentation

◆ Superclass

typedef ctkDoubleSpinBox qMRMLSpinBox::Superclass

Definition at line 77 of file qMRMLSpinBox.h.

Member Enumeration Documentation

◆ UnitAwareProperty

Enumerator
None 
Prefix 
Suffix 
Precision 
MinimumValue 
MaximumValue 
Scaling 

Definition at line 83 of file qMRMLSpinBox.h.

Property Documentation

◆ quantity

QString qMRMLSpinBox::quantity
readwrite

Get/Set the quantity is used to determine what unit the spinbox is in. This determines the spinbox properties like minimum, maximum, single step, prefix and suffix.

Definition at line 65 of file qMRMLSpinBox.h.

◆ unitAwareProperties

UnitAwareProperties qMRMLSpinBox::unitAwareProperties
readwrite

Get/Set the properties that will be determined by units. If a property is aware of units, it will update itself to the unit's property value automatically. Otherwise, this property is left to be changed by its accessors. All flags are on by default.

See also
setQuantity(), quantity()

Definition at line 74 of file qMRMLSpinBox.h.

Constructor & Destructor Documentation

◆ qMRMLSpinBox()

qMRMLSpinBox::qMRMLSpinBox ( QWidget *  parent = nullptr)
explicit

Construct an empty qMRMLSpinBox with a null scene.

◆ ~qMRMLSpinBox()

qMRMLSpinBox::~qMRMLSpinBox ( )
override

Member Function Documentation

◆ mrmlScene()

Q_INVOKABLE vtkMRMLScene* qMRMLSpinBox::mrmlScene ( ) const

Get MRML scene that has been set by setMRMLScene(). Default is no scene.

See also
setMRMLScene()

◆ quantity()

QString qMRMLSpinBox::quantity ( ) const

◆ setMRMLScene

virtual void qMRMLSpinBox::setMRMLScene ( vtkMRMLScene scene)
virtualslot

Set the scene the spinbox listens to.

See also
mrmlScene()

◆ setQuantity

void qMRMLSpinBox::setQuantity ( const QString &  baseName)
slot

◆ setUnitAwareProperties

void qMRMLSpinBox::setUnitAwareProperties ( UnitAwareProperties  flags)
slot

◆ unitAwareProperties()

UnitAwareProperties qMRMLSpinBox::unitAwareProperties ( ) const

◆ updateWidgetFromUnitNode

void qMRMLSpinBox::updateWidgetFromUnitNode ( )
protectedslot

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLSpinBoxPrivate> qMRMLSpinBox::d_ptr
protected

Definition at line 116 of file qMRMLSpinBox.h.


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