1 #ifndef CSV_WORLD_ENUMDELEGATE_H
2 #define CSV_WORLD_ENUMDELEGATE_H
7 #include <QStyledItemDelegate>
20 std::vector<std::pair<int, QString> >
mValues;
22 int getValueIndex(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
27 const QModelIndex& index)
const;
30 const QModelIndex& index,
int type)
const;
34 EnumDelegate (
const std::vector<std::pair<int, QString> >& values,
38 const QStyleOptionViewItem& option,
39 const QModelIndex& index)
const;
42 const QStyleOptionViewItem& option,
43 const QModelIndex& index,
46 virtual void setEditorData (
QWidget *editor,
const QModelIndex& index,
bool tryDisplay =
false)
const;
48 virtual void paint (QPainter *painter,
const QStyleOptionViewItem& option,
49 const QModelIndex& index)
const;
51 virtual QSize
sizeHint(
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
58 std::vector<std::pair<int, QString> >
mValues;
74 void add (
int value,
const QString&
name);
virtual void setEditorData(QWidget *editor, const QModelIndex &index, bool tryDisplay=false) const
Definition: enumdelegate.cpp:85
int getValueIndex(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: enumdelegate.cpp:12
Display
Definition: columnbase.hpp:39
EnumDelegateFactory()
Definition: enumdelegate.cpp:141
Definition: enumdelegate.hpp:55
std::vector< std::pair< int, QString > > mValues
Definition: enumdelegate.hpp:20
virtual void addCommands(QAbstractItemModel *model, const QModelIndex &index, int type) const
Definition: enumdelegate.cpp:49
virtual void setModelDataImp(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: enumdelegate.cpp:30
void add(int value, const QString &name)
Definition: enumdelegate.cpp:172
std::vector< std::pair< int, QString > > mValues
Definition: enumdelegate.hpp:58
Definition: commanddispatcher.hpp:20
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: enumdelegate.cpp:107
virtual CommandDelegate * makeDelegate(CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, QObject *parent) const
The ownership of the returned CommandDelegate is transferred to the caller.
Definition: enumdelegate.cpp:166
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: enumdelegate.cpp:63
Definition: columnbase.hpp:41
Definition: document.hpp:57
EnumDelegate(const std::vector< std::pair< int, QString > > &values, CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, QObject *parent)
Definition: enumdelegate.cpp:56
Integer value that represents an enum and is interacted with via a combobox.
Definition: enumdelegate.hpp:16
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: enumdelegate.cpp:119
const char * name
Definition: crashcatcher.cpp:59