Table model for viewing and editing the contents of an mitk::IsoDoseLevelSet.
More...
#include <QmitkIsoDoseLevelSetModel.h>
Table model for viewing and editing the contents of an mitk::IsoDoseLevelSet.
This model exposes an IsoDoseLevelSet as a 4-column table with columns for:
- Column 0: Color (Qt::EditRole returns QColor)
- Column 1: Dose value (absolute in Gy or relative in %)
- Column 2: Iso line visibility (boolean)
- Column 3: Color wash visibility (boolean)
Use the specialized delegates QmitkDoseColorDelegate, QmitkDoseValueDelegate, and QmitkDoseVisualStyleDelegate for proper rendering and editing in views.
- See also
- QmitkDoseColorDelegate
-
QmitkDoseValueDelegate
-
QmitkDoseVisualStyleDelegate
-
mitk::IsoDoseLevelSet
Definition at line 41 of file QmitkIsoDoseLevelSetModel.h.
◆ QmitkIsoDoseLevelSetModel()
| QmitkIsoDoseLevelSetModel::QmitkIsoDoseLevelSetModel |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
Constructor.
- Parameters
-
| [in] | parent | Optional parent QObject. |
◆ ~QmitkIsoDoseLevelSetModel()
| QmitkIsoDoseLevelSetModel::~QmitkIsoDoseLevelSetModel |
( |
| ) |
|
|
inlineoverride |
◆ addLevel()
| void QmitkIsoDoseLevelSetModel::addLevel |
( |
| ) |
|
Adds a new iso dose level at the end of the set.
The new level has a dose value slightly above the current maximum (or 0.01 if the set is empty), default color, and both visibility flags set to true.
◆ columnCount()
| int QmitkIsoDoseLevelSetModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of columns (always 4).
- Parameters
-
| [in] | parent | The parent index. |
- Returns
- 4 (color, dose value, iso line visibility, color wash visibility).
◆ data()
| QVariant QmitkIsoDoseLevelSetModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
|
override |
Returns data for the given index and role.
- Parameters
-
| [in] | index | The model index to query. |
| [in] | role | The Qt role for the data request. |
- Returns
- The requested data as QVariant.
◆ deleteLevel()
| void QmitkIsoDoseLevelSetModel::deleteLevel |
( |
const QModelIndex & |
index | ) |
|
Deletes the iso dose level at the given model index.
- Parameters
-
| [in] | index | The model index of the level to delete. Invalid indices are ignored. |
◆ flags()
| Qt::ItemFlags QmitkIsoDoseLevelSetModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
Returns item flags for the given index.
- Parameters
-
| [in] | index | The model index to query. |
- Returns
- The Qt::ItemFlags for the given index.
◆ getReferenceDose()
Returns the current reference dose.
- Returns
- The reference dose in Gy.
◆ getShowAbsoluteDose()
| bool QmitkIsoDoseLevelSetModel::getShowAbsoluteDose |
( |
| ) |
const |
Returns whether dose values are displayed as absolute values.
- Returns
- True if absolute dose display mode is active.
◆ getVisibilityEditOnly()
| bool QmitkIsoDoseLevelSetModel::getVisibilityEditOnly |
( |
| ) |
const |
Returns whether the model allows editing only visibility columns.
- Returns
- True if dose value and color columns are read-only.
◆ headerData()
| QVariant QmitkIsoDoseLevelSetModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role |
|
) |
| const |
|
override |
Returns header data for the given section, orientation, and role.
- Parameters
-
| [in] | section | The column section index. |
| [in] | orientation | The header orientation (only horizontal is supported). |
| [in] | role | The Qt role for the data request. |
- Returns
- The header text as QVariant.
◆ invertVisibilityColorWash()
| void QmitkIsoDoseLevelSetModel::invertVisibilityColorWash |
( |
| ) |
|
Inverts the color wash visibility of all levels.
◆ invertVisibilityIsoLines()
| void QmitkIsoDoseLevelSetModel::invertVisibilityIsoLines |
( |
| ) |
|
Inverts the iso line visibility of all levels.
◆ isModified()
| bool QmitkIsoDoseLevelSetModel::isModified |
( |
| ) |
|
Checks whether the model content has been modified since the last setIsoDoseLevelSet() call.
- Returns
- True if modifications have been made.
◆ rowCount()
| int QmitkIsoDoseLevelSetModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of iso dose levels in the set.
- Parameters
-
| [in] | parent | The parent index (must be invalid for table models). |
- Returns
- The number of rows (iso dose levels).
◆ setData()
| bool QmitkIsoDoseLevelSetModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
Sets data at the given index for the given role.
Modifies the underlying IsoDoseLevelSet by cloning the affected level, updating the changed field, and reinserting it (which re-sorts the set).
- Parameters
-
| [in] | index | The model index to modify. |
| [in] | value | The new value as QVariant. |
| [in] | role | The Qt role (only Qt::EditRole is handled). |
- Returns
- True if the data was successfully set.
◆ setIsoDoseLevelSet()
Sets the iso dose level set managed by this model and resets the modified flag.
- Parameters
-
| [in] | pSet | The IsoDoseLevelSet to display and edit. If nullptr, no action is taken. |
◆ setReferenceDose
| void QmitkIsoDoseLevelSetModel::setReferenceDose |
( |
double |
newReferenceDose | ) |
|
|
slot |
Sets the reference dose used for absolute/relative conversion.
- Parameters
-
| [in] | newReferenceDose | The new reference dose in Gy. Must be positive. |
- Exceptions
-
◆ setShowAbsoluteDose
| void QmitkIsoDoseLevelSetModel::setShowAbsoluteDose |
( |
bool |
showAbsoluteDose | ) |
|
|
slot |
Sets whether dose values should be displayed as absolute (Gy) or relative (%).
- Parameters
-
| [in] | showAbsoluteDose | If true, values are shown in Gy; otherwise in percent. |
◆ setVisibilityEditOnly
| void QmitkIsoDoseLevelSetModel::setVisibilityEditOnly |
( |
bool |
onlyVisibility | ) |
|
|
slot |
Sets whether the model allows editing only the visibility columns.
- Parameters
-
| [in] | onlyVisibility | If true, dose value and color columns become read-only. |
◆ swapVisibility()
| void QmitkIsoDoseLevelSetModel::swapVisibility |
( |
| ) |
|
Swaps the iso line and color wash visibility for all levels.
◆ switchVisibilityColorWash()
| void QmitkIsoDoseLevelSetModel::switchVisibilityColorWash |
( |
bool |
activate | ) |
|
Sets the color wash visibility for all levels.
- Parameters
-
| [in] | activate | If true, all color washes are made visible; if false, all are hidden. |
◆ switchVisibilityIsoLines()
| void QmitkIsoDoseLevelSetModel::switchVisibilityIsoLines |
( |
bool |
activate | ) |
|
Sets the iso line visibility for all levels.
- Parameters
-
| [in] | activate | If true, all iso lines are made visible; if false, all are hidden. |
The documentation for this class was generated from the following file: