1 #ifndef CSV_WORLD_UTIL_H
2 #define CSV_WORLD_UTIL_H
6 #include <QAbstractTableModel>
7 #include <QStyledItemDelegate>
9 #include "../../model/world/columnbase.hpp"
10 #include "../../model/doc/document.hpp"
18 class CommandDispatcher;
40 int rowCount (
const QModelIndex & parent = QModelIndex())
const;
42 int columnCount (
const QModelIndex & parent = QModelIndex())
const;
44 QVariant
data (
const QModelIndex & index,
int role = Qt::DisplayRole)
const;
46 bool setData (
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole);
68 std::map<CSMWorld::ColumnBase::Display, CommandDelegateFactory *>
mFactories;
116 const QModelIndex& index)
const;
125 const QModelIndex& index)
const;
128 const QStyleOptionViewItem& option,
129 const QModelIndex& index)
const;
132 const QStyleOptionViewItem& option,
133 const QModelIndex& index,
CommandDelegate(CSMWorld::CommandDispatcher *commandDispatcher, CSMDoc::Document &document, QObject *parent)
Definition: util.cpp:148
CSMDoc::Document & getDocument() const
Definition: util.cpp:113
QVariant getData() const
Definition: util.cpp:52
void setEditLock(bool locked)
Definition: util.cpp:277
CommandDelegateFactoryCollection()
Definition: util.cpp:63
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Definition: util.cpp:287
std::map< CSMWorld::ColumnBase::Display, CommandDelegateFactory * > mFactories
Definition: util.hpp:68
NastyTableModelHack(QAbstractItemModel &model)
Definition: util.cpp:27
QUndoStack & getUndoStack() const
Definition: util.cpp:108
Display
Definition: columnbase.hpp:39
CSMWorld::CommandDispatcher * mCommandDispatcher
Definition: util.hpp:104
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: util.cpp:36
virtual ~CommandDelegateFactory()
Definition: util.cpp:58
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: util.cpp:46
bool mEditLock
Definition: util.hpp:103
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: util.cpp:41
virtual void settingChanged(const CSMPrefs::Setting *setting)
Definition: util.cpp:340
~CommandDelegateFactoryCollection()
Definition: util.cpp:71
Getting the data out of an editor widget.
Definition: util.hpp:31
CSMDoc::Document & mDocument
Definition: util.hpp:105
bool isEditLocked() const
Definition: util.cpp:282
CSMWorld::ColumnBase::Display getDisplayTypeFromIndex(const QModelIndex &index) const
Definition: util.cpp:118
virtual CommandDelegate * makeDelegate(CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, QObject *parent) const =0
The ownership of the returned CommandDelegate is transferred to the caller.
QAbstractItemModel & mModel
Definition: util.hpp:33
Use commands instead of manipulating the model directly.
Definition: util.hpp:65
CommandDelegateFactoryCollection & operator=(const CommandDelegateFactoryCollection &)
QVariant mData
Definition: util.hpp:34
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: util.cpp:165
Definition: commanddispatcher.hpp:20
Definition: setting.hpp:22
static CommandDelegateFactoryCollection * sThis
Definition: util.hpp:67
Definition: document.hpp:57
void add(CSMWorld::ColumnBase::Display display, CommandDelegateFactory *factory)
Definition: util.cpp:81
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: util.cpp:154
CommandDelegate * makeDelegate(CSMWorld::ColumnBase::Display display, CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document &document, QObject *parent) const
Definition: util.cpp:87
virtual void setModelDataImp(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Definition: util.cpp:124
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: util.cpp:31