23#ifndef __qSlicerTerminologyItemDelegate_h
24#define __qSlicerTerminologyItemDelegate_h
27#include <QStyledItemDelegate>
30#include "qSlicerTerminologiesModuleWidgetsExport.h"
61 QWidget*
createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
63 void setEditorData(QWidget *editor,
const QModelIndex &index)
const override;
64 void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index)
const override;
66 void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
void userSetCustomNameOrColor()
void setEditorData(QWidget *editor, const QModelIndex &index) const override
@ TerminologyRole
Serialized terminology entry.
@ 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.
@ GeneratedColorRole
Auto-generated color that is used if the selected terminology contains no recommended color.
@ DefaultTerminologyRole
Serialized default terminology entry, which is used to initialize the terminology selector if the seg...
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.
qSlicerTerminologyItemDelegate(QObject *parent=nullptr)
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override