mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 08:33:54 -07:00
Sets dialog: new columns and sorting
Added "order key", "set type" and "release date" columns Use a proxy model to sort the table made the dialog wider accordingly
This commit is contained in:
parent
cb37073828
commit
8542d875d3
4 changed files with 45 additions and 10 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define SETSMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QMimeData>
|
||||
#include "carddatabase.h"
|
||||
|
||||
|
|
@ -17,11 +18,16 @@ public:
|
|||
|
||||
class SetsModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
private:
|
||||
static const int NUM_COLS = 5;
|
||||
SetList sets;
|
||||
public:
|
||||
enum SetsColumns { SortKeyCol, SetTypeCol, ShortNameCol, LongNameCol, ReleaseDateCol };
|
||||
|
||||
SetsModel(CardDatabase *_db, QObject *parent = 0);
|
||||
~SetsModel();
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &/*parent*/) const { return 2; }
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const { return NUM_COLS; }
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
|
@ -30,8 +36,11 @@ public:
|
|||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||||
QStringList mimeTypes() const;
|
||||
private:
|
||||
SetList sets;
|
||||
};
|
||||
|
||||
class SetsProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SetsProxyModel(QObject *parent = 0);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue