Crossfire Server, Trunk
CREMessageItemModel.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef CREMESSAGEITEMMODEL_H
14 #define CREMESSAGEITEMMODEL_H
15 
16 #include <QObject>
17 #include <QAbstractItemModel>
18 
19 #include "MessageFile.h"
20 
24 class CREMessageItemModel : public QAbstractItemModel
25 {
26 public:
27  CREMessageItemModel(QObject* parent);
28  virtual ~CREMessageItemModel();
29 
31 
32  void setSelectedRule(const QModelIndex& index);
33 
34  virtual int columnCount(const QModelIndex& parent) const override;
35  virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
36  virtual QModelIndex parent(const QModelIndex& index) const override;
37  virtual int rowCount(const QModelIndex & parent) const override;
38  virtual QVariant data(const QModelIndex& index, int role) const override;
39  virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
40  virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
41  virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
42  virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
43  virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
44 
45  void moveUpDown(int row, bool up);
46  void duplicateRow(int row);
47 
48 protected:
50  QSet<int> myBlue, myRed;
51 };
52 
53 #endif /* CREMESSAGEITEMMODEL_H */
54 
CREMessageItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const override
Definition: CREMessageItemModel.cpp:143
CREMessageItemModel::insertRows
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Definition: CREMessageItemModel.cpp:280
CREMessageItemModel::myRed
QSet< int > myRed
Definition: CREMessageItemModel.h:50
CREMessageItemModel::data
virtual QVariant data(const QModelIndex &index, int role) const override
Definition: CREMessageItemModel.cpp:171
CREMessageItemModel::setMessage
void setMessage(MessageFile *message)
Definition: CREMessageItemModel.cpp:25
CREMessageItemModel::myMessage
MessageFile * myMessage
Definition: CREMessageItemModel.h:49
CREMessageItemModel::moveUpDown
void moveUpDown(int row, bool up)
Definition: CREMessageItemModel.cpp:316
CREMessageItemModel::~CREMessageItemModel
virtual ~CREMessageItemModel()
Definition: CREMessageItemModel.cpp:21
MessageFile
Definition: MessageFile.h:68
CREMessageItemModel::CREMessageItemModel
CREMessageItemModel(QObject *parent)
Definition: CREMessageItemModel.cpp:17
CREMessageItemModel::removeRows
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Definition: CREMessageItemModel.cpp:297
CREMessageItemModel::columnCount
virtual int columnCount(const QModelIndex &parent) const override
Definition: CREMessageItemModel.cpp:136
CREMessageItemModel::rowCount
virtual int rowCount(const QModelIndex &parent) const override
Definition: CREMessageItemModel.cpp:155
disinfect.count
int count
Definition: disinfect.py:7
CREMessageItemModel
Definition: CREMessageItemModel.h:24
CREMessageItemModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: CREMessageItemModel.cpp:234
diamondslots.message
string message
Definition: diamondslots.py:57
MessageFile.h
autojail.value
value
Definition: autojail.py:6
CREMessageItemModel::setSelectedRule
void setSelectedRule(const QModelIndex &index)
Definition: CREMessageItemModel.cpp:32
CREMessageItemModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Definition: CREMessageItemModel.cpp:210
CREMessageItemModel::myBlue
QSet< int > myBlue
Definition: CREMessageItemModel.h:50
CREMessageItemModel::parent
virtual QModelIndex parent(const QModelIndex &index) const override
Definition: CREMessageItemModel.cpp:150
CREMessageItemModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Definition: CREMessageItemModel.cpp:241
CREMessageItemModel::duplicateRow
void duplicateRow(int row)
Definition: CREMessageItemModel.cpp:333