42 lines
1.7 KiB
C++
42 lines
1.7 KiB
C++
#ifndef CHECKQUEUETABLEMODEL_H
|
|
#define CHECKQUEUETABLEMODEL_H
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <check/check.h>
|
|
|
|
class CheckQueueTableModel : public QAbstractTableModel
|
|
{
|
|
Q_OBJECT
|
|
static constexpr const char* MimeType = "application/check.queue.model";
|
|
public:
|
|
explicit CheckQueueTableModel(std::vector<Check> *checks, QObject *parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
Qt::DropActions supportedDropActions() const override;
|
|
|
|
bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
|
|
bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
|
|
|
|
QStringList mimeTypes() const override;
|
|
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int, int, const QModelIndex &);
|
|
QMimeData* mimeData(const QModelIndexList &indexes) const override;
|
|
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
|
|
|
void sort(int column, Qt::SortOrder order) override;
|
|
private:
|
|
std::vector<Check> *checks;
|
|
bool compare(const Check& check_a, const Check& check_b, int column);
|
|
signals:
|
|
void editCompleted(const QString &);
|
|
};
|
|
|
|
#endif // CHECKQUEUETABLEMODEL_H
|