Qt table model for viewing and editing the constraints of a SimpleBarrierConstraintChecker.
More...
#include <QmitkSimpleBarrierModel.h>
Qt table model for viewing and editing the constraints of a SimpleBarrierConstraintChecker.
This model adapts a mitk::SimpleBarrierConstraintChecker for use with a Qt table view. Each row represents a single constraint, with columns for: affected parameters, constraint type (upper/lower), barrier threshold value, penalty zone width, and parameter units. All columns except the unit column are editable.
- See also
- QmitkSimpleBarrierManagerWidget
-
QmitkSimpleBarrierTypeDelegate
-
QmitkSimpleBarrierParametersDelegate
-
mitk::SimpleBarrierConstraintChecker
Definition at line 38 of file QmitkSimpleBarrierModel.h.
◆ QmitkSimpleBarrierModel()
| QmitkSimpleBarrierModel::QmitkSimpleBarrierModel |
( |
QObject * |
parent = nullptr | ) |
|
Constructs a QmitkSimpleBarrierModel.
Creates an empty internal SimpleBarrierConstraintChecker.
- Parameters
-
| [in] | parent | Optional parent QObject. |
◆ ~QmitkSimpleBarrierModel()
| QmitkSimpleBarrierModel::~QmitkSimpleBarrierModel |
( |
| ) |
|
|
inlineoverride |
◆ addConstraint()
| void QmitkSimpleBarrierModel::addConstraint |
( |
| ) |
|
Adds a new default lower barrier constraint for parameter 0 with barrier value 0.
Triggers a full model reset and sets the modified flag.
◆ columnCount()
| int QmitkSimpleBarrierModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of columns (always 5).
- Parameters
-
| [in] | parent | The parent model index. |
- Returns
- 5 (parameters, type, value, width, unit). Returns 0 if parent is valid.
◆ data()
| QVariant QmitkSimpleBarrierModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
|
override |
Returns data for the given index and role.
Column 0: affected parameter names (display: selected names; edit: all available names). Column 1: constraint type ("upper" or "lower"). Column 2: barrier threshold value. Column 3: penalty zone width. Column 4: units of the affected parameters.
- Parameters
-
| [in] | index | The model index to query. |
| [in] | role | The Qt item data role. |
- Returns
- The requested data as QVariant.
◆ deleteConstraint()
| void QmitkSimpleBarrierModel::deleteConstraint |
( |
const QModelIndex & |
index | ) |
|
Deletes the constraint at the specified model index.
Does nothing if the index is invalid or out of range. Triggers a full model reset and sets the modified flag.
- Parameters
-
| [in] | index | The model index of the constraint to delete. |
◆ flags()
| Qt::ItemFlags QmitkSimpleBarrierModel::flags |
( |
const QModelIndex & |
index | ) |
const |
|
override |
Returns item flags for the given model index.
Columns 0 through 3 (parameters, type, value, width) are editable. Column 4 (unit) is read-only.
- Parameters
-
| [in] | index | The model index to query. |
- Returns
- The item flags.
◆ headerData()
| QVariant QmitkSimpleBarrierModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role |
|
) |
| const |
|
override |
Returns header data for the specified section.
Horizontal headers are: "Parameters", "Type", "Value", "Width", "Unit".
- Parameters
-
| [in] | section | The column index. |
| [in] | orientation | The header orientation. |
| [in] | role | The Qt item data role. |
- Returns
- The header data as QVariant.
◆ isModified()
| bool QmitkSimpleBarrierModel::isModified |
( |
| ) |
|
Indicates whether the model content has been modified since the last setChecker() call.
- Returns
- True if modified, false otherwise.
◆ rowCount()
| int QmitkSimpleBarrierModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
Returns the number of constraints (rows).
- Parameters
-
| [in] | parent | The parent model index. |
- Returns
- The number of constraints. Returns 0 if parent is valid.
◆ setChecker()
Sets the constraint checker and parameter metadata managed by this model.
If the provided checker differs from the current one, the model is reset. The modified flag is cleared. If pChecker is nullptr, a new empty checker is created.
- Parameters
-
| [in] | pChecker | Pointer to the SimpleBarrierConstraintChecker to manage. |
| [in] | names | List of parameter names. The index corresponds to the parameter index in the fitting model. |
| [in] | units | Map of parameter names to their unit strings. |
◆ setData()
| bool QmitkSimpleBarrierModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
Sets data for a given index.
Column 0: expects a QStringList of selected parameter names. Column 1: expects an integer (0 = lower, 1 = upper). Column 2: expects a double barrier value. Column 3: expects a double width value.
- Parameters
-
| [in] | index | The model index to modify. |
| [in] | value | The new value to set. |
| [in] | role | The Qt item data role (only Qt::EditRole is handled). |
- Returns
- True if data was successfully modified, false otherwise.
The documentation for this class was generated from the following file: