Item delegate for rendering and toggling boolean properties (e.g., visibility, lock) in a QmitkMultiLabelTreeView.
More...
#include <QmitkLabelToggleItemDelegate.h>
|
| | QmitkLabelToggleItemDelegate (const QIcon &onIcon, const QIcon &offIcon, QObject *parent=nullptr) |
| | Constructs the toggle item delegate with on/off icons. More...
|
| |
| bool | editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override |
| | Handles mouse click events to toggle the boolean property. More...
|
| |
| void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Paints the on or off icon based on the current value. More...
|
| |
| QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Returns the preferred size for the toggle icon. More...
|
| |
Item delegate for rendering and toggling boolean properties (e.g., visibility, lock) in a QmitkMultiLabelTreeView.
Displays an on/off icon based on the current boolean state and toggles the value on mouse click. Used for visibility and lock columns in the multi-label tree view.
- See also
- QmitkMultiLabelTreeView
-
QmitkMultiLabelTreeModel
-
QmitkLabelColorItemDelegate
Definition at line 32 of file QmitkLabelToggleItemDelegate.h.
◆ QmitkLabelToggleItemDelegate()
| QmitkLabelToggleItemDelegate::QmitkLabelToggleItemDelegate |
( |
const QIcon & |
onIcon, |
|
|
const QIcon & |
offIcon, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
|
explicit |
Constructs the toggle item delegate with on/off icons.
- Parameters
-
| [in] | onIcon | The icon displayed when the property is true/on. |
| [in] | offIcon | The icon displayed when the property is false/off. |
| [in] | parent | Optional parent QObject. |
◆ editorEvent()
| bool QmitkLabelToggleItemDelegate::editorEvent |
( |
QEvent * |
event, |
|
|
QAbstractItemModel * |
model, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| |
|
override |
Handles mouse click events to toggle the boolean property.
- Parameters
-
| [in] | event | The editor event. |
| [in] | model | The model being edited. |
| [in] | option | The style option for the item. |
| [in] | index | The model index of the item. |
- Returns
- True if the event was handled; false otherwise.
◆ paint()
| void QmitkLabelToggleItemDelegate::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Paints the on or off icon based on the current value.
- Parameters
-
| [in] | painter | The painter used for rendering. |
| [in] | option | The style option for the item. |
| [in] | index | The model index of the item. |
◆ sizeHint()
| QSize QmitkLabelToggleItemDelegate::sizeHint |
( |
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Returns the preferred size for the toggle icon.
- Parameters
-
| [in] | option | The style option for the item. |
| [in] | index | The model index of the item. |
- Returns
- The size hint for the delegate.
◆ m_OffIcon
| QIcon QmitkLabelToggleItemDelegate::m_OffIcon |
|
protected |
◆ m_OnIcon
| QIcon QmitkLabelToggleItemDelegate::m_OnIcon |
|
protected |
The documentation for this class was generated from the following file: