23#ifndef __qSlicerTerminologyItemDelegate_h
24#define __qSlicerTerminologyItemDelegate_h
27#include <QStyledItemDelegate>
30#include "qSlicerTerminologiesModuleWidgetsExport.h"
38 Q_PROPERTY(
bool useDecorationRole READ useDecorationRole WRITE setUseDecorationRole)
45 TerminologyRole = Qt::UserRole + 9,
59 QWidget*
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
61 void setEditorData(QWidget *editor,
const QModelIndex &index)
const override;
62 void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index)
const override;
64 void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
90 bool UseDecorationRole{
true };
void userSetCustomNameOrColor()
void setEditorData(QWidget *editor, const QModelIndex &index) const override
@ ColorRole
Color of the segment. We do not want to show color in the name cell so we need a custom role.
@ NameRole
Name of the segment (either custom or auto-generated)
@ NameAutoGeneratedRole
Flag indicating whether the selected name is auto-generated form terminology.
void setUseTerminologySelectorCallback(std::function< bool()> callback)
This method allow setting a callback function that takes a void* argument and returns bool.
std::function< bool()> UserSetCustomNameOrColorCallback
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
void setUseDecorationRole(bool useDecorationRole)
void setUserSetCustomNameOrColorCallback(std::function< bool()> callback)
This can be used for asking the user if he wants to switch to using simple name&color selector.
std::function< bool()> UseTerminologySelectorCallback
The settings key used to specify whether standard terminologies are used for name column.
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override