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 <QSet>
17 
18 #include <QObject>
19 #include <QAbstractItemModel>
20 
21 #include "MessageFile.h"
22 
26 class CREMessageItemModel : public QAbstractItemModel
27 {
28  Q_OBJECT
29 public:
30  CREMessageItemModel(QObject* parent);
31  virtual ~CREMessageItemModel();
32 
34 
35  void setSelectedRule(const QModelIndex& index);
36 
37  virtual int columnCount(const QModelIndex& parent) const override;
38  virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
39  virtual QModelIndex parent(const QModelIndex& index) const override;
40  virtual int rowCount(const QModelIndex & parent) const override;
41  virtual QVariant data(const QModelIndex& index, int role) const override;
42  virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
43  virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
44  virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
45  virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
46  virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
47 
48  void moveUpDown(int row, bool up);
49  void duplicateRow(int row);
50 
51 protected:
53  QSet<int> myBlue, myRed;
54 };
55 
56 #endif /* CREMESSAGEITEMMODEL_H */
57 
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:53
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:52
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:26
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:53
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