Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
uat_model.h
Go to the documentation of this file.
1
14#ifndef UAT_MODEL_H
15#define UAT_MODEL_H
16
17#include <config.h>
18
19#include <QAbstractItemModel>
20#include <QList>
21#include <QMap>
22#include <epan/uat.h>
23
27class UatModel : public QAbstractTableModel
28{
29 Q_OBJECT
30public:
36 UatModel(QObject *parent, uat_t *uat = 0);
37
43 UatModel(QObject *parent, QString tableName);
44
50 Qt::ItemFlags flags(const QModelIndex &index) const;
51
58 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
59
67 QVariant headerData(int section, Qt::Orientation orientation,
68 int role = Qt::DisplayRole) const;
69
75 int rowCount(const QModelIndex &parent = QModelIndex()) const;
76
82 int columnCount(const QModelIndex &parent = QModelIndex()) const;
83
91 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
92
100 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
101
109 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
110
116 QModelIndex appendEntry(QVariantList row);
117
123 QModelIndex copyRow(QModelIndex original);
124
131 bool moveRow(int src_row, int dst_row);
132
142 bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild);
143
144 //Drag & drop functionality
149 Qt::DropActions supportedDropActions() const;
150
160 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
161
165 void reloadUat();
166
171 bool hasErrors() const;
172
176 void clearAll();
177
185 bool applyChanges(QString &error);
186
193 bool revertChanges(QString &error);
194
202 QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role = Qt::DisplayRole);
203
204private:
212 bool checkField(int row, int col, char **error) const;
213
219 QList<int> checkRow(int row);
220
225 void loadUat(uat_t * uat = 0);
226
233 bool moveRowPrivate(int src_row, int dst_row);
234
236 uat_t *uat_;
237
239 bool applying_;
240
242 QVector<bool> dirty_records;
243
245 QVector<QMap<int, QString> > record_errors;
246};
247#endif // UAT_MODEL_H
Table model for representing and managing User Accessible Tables (UAT).
Definition uat_model.h:28
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles dropped MIME data to perform drag and drop operations.
Definition uat_model.cpp:666
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Removes a specified number of rows from the model.
Definition uat_model.cpp:475
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of columns under a given parent.
Definition uat_model.cpp:304
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Retrieves header data for the table.
Definition uat_model.cpp:277
Qt::DropActions supportedDropActions() const
Returns the supported drag and drop actions for the model.
Definition uat_model.cpp:661
bool revertChanges(QString &error)
Definition uat_model.cpp:100
bool applyChanges(QString &error)
Definition uat_model.cpp:75
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Retrieves data for a given index and role.
Definition uat_model.cpp:172
Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for a given index.
Definition uat_model.cpp:118
QModelIndex appendEntry(QVariantList row)
Appends a new entry to the end of the table.
Definition uat_model.cpp:314
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
Moves multiple rows from one position to another.
Definition uat_model.cpp:577
void clearAll()
Clears all entries from the model.
Definition uat_model.cpp:492
bool moveRow(int src_row, int dst_row)
Moves a row from one position to another.
Definition uat_model.cpp:572
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Inserts a specified number of rows into the model.
Definition uat_model.cpp:444
QModelIndex copyRow(QModelIndex original)
Copies an existing row and inserts the copy.
Definition uat_model.cpp:505
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows under a given parent.
Definition uat_model.cpp:294
QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role=Qt::DisplayRole)
Finds the first row containing specific content in a given column.
Definition uat_model.cpp:262
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the data for a specific index.
Definition uat_model.cpp:367
void reloadUat()
Reloads the UAT data from the underlying structure.
Definition uat_model.cpp:61
bool hasErrors() const
Checks if any records in the model currently have validation errors.
Definition uat_model.cpp:608
Represents a User Accessible Table (UAT), managing a set of user-editable records exposed to a dissec...
Definition uat-int.h:44