Item delegate for rendering and editing MatchPoint algorithm meta-properties in a QTableView.
More...
#include <QmitkMapPropertyDelegate.h>
|
| | QmitkMapPropertyDelegate (QObject *parent=nullptr) |
| | Constructs the property delegate. More...
|
| |
| void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Paints the delegate for the given model index. More...
|
| |
| QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Creates an appropriate editor widget for the property at the given index. More...
|
| |
| void | setEditorData (QWidget *editor, const QModelIndex &index) const override |
| | Populates the editor widget with data from the model. More...
|
| |
| void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override |
| | Commits data from the editor widget back to the model. More...
|
| |
| void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Updates the editor geometry to fit the item's bounding rectangle. More...
|
| |
Item delegate for rendering and editing MatchPoint algorithm meta-properties in a QTableView.
This delegate creates appropriate editor widgets (QSpinBox, QDoubleSpinBox, QComboBox, or default QStyledItemDelegate editors) based on the Qt type of the property value. It handles data transfer between the editors and the underlying model (typically a QmitkMAPAlgorithmModel) and commits changes on relevant user interaction events (key release, mouse release, focus, etc.).
Supported property types and their editors:
int: QSpinBox
float: QDoubleSpinBox (5 decimal places)
QStringList: QComboBox (non-editable)
- Other types: default QStyledItemDelegate editor
- See also
- QmitkMAPAlgorithmModel, QmitkAlgorithmSettingsConfig
Definition at line 39 of file QmitkMapPropertyDelegate.h.
◆ QmitkMapPropertyDelegate()
| QmitkMapPropertyDelegate::QmitkMapPropertyDelegate |
( |
QObject * |
parent = nullptr | ) |
|
Constructs the property delegate.
- Parameters
-
| [in] | parent | Optional parent QObject. |
◆ createEditor()
| QWidget* QmitkMapPropertyDelegate::createEditor |
( |
QWidget * |
parent, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Creates an appropriate editor widget for the property at the given index.
The editor type is determined by the Qt meta type of the data at the index: QSpinBox for int, QDoubleSpinBox for float, QComboBox for QStringList, or the default delegate editor for other types.
- Parameters
-
| [in] | parent | The parent widget for the editor. |
| [in] | option | Style options for the item. |
| [in] | index | The model index identifying the property to edit. |
- Returns
- The created editor widget, or a QLabel if the data is not editable.
◆ eventFilter()
| bool QmitkMapPropertyDelegate::eventFilter |
( |
QObject * |
o, |
|
|
QEvent * |
e |
|
) |
| |
|
overrideprotected |
◆ paint()
| void QmitkMapPropertyDelegate::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Paints the delegate for the given model index.
- Parameters
-
| [in] | painter | The painter to use. |
| [in] | option | Style options for the item. |
| [in] | index | The model index to paint. |
◆ setEditorData()
| void QmitkMapPropertyDelegate::setEditorData |
( |
QWidget * |
editor, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Populates the editor widget with data from the model.
- Parameters
-
| [in] | editor | The editor widget to populate. |
| [in] | index | The model index providing the data. |
◆ setModelData()
| void QmitkMapPropertyDelegate::setModelData |
( |
QWidget * |
editor, |
|
|
QAbstractItemModel * |
model, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Commits data from the editor widget back to the model.
- Parameters
-
| [in] | editor | The editor widget containing the user's input. |
| [in,out] | model | The model to receive the data. |
| [in] | index | The model index identifying the property being edited. |
◆ updateEditorGeometry()
| void QmitkMapPropertyDelegate::updateEditorGeometry |
( |
QWidget * |
editor, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Updates the editor geometry to fit the item's bounding rectangle.
- Parameters
-
| [in] | editor | The editor widget to resize. |
| [in] | option | Style options containing the geometry. |
| [in] | index | The model index (unused). |
The documentation for this class was generated from the following file: