mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-09 15:54:47 -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
|
|
@ -3,21 +3,32 @@
|
|||
#include "main.h"
|
||||
#include <QTreeView>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
|
||||
WndSets::WndSets(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
model = new SetsModel(db, this);
|
||||
proxyModel = new SetsProxyModel(this);
|
||||
proxyModel->setSourceModel(model);
|
||||
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
view = new QTreeView;
|
||||
view->setModel(model);
|
||||
view->setModel(proxyModel);
|
||||
view->setAlternatingRowColors(true);
|
||||
view->setUniformRowHeights(true);
|
||||
view->setAllColumnsShowFocus(true);
|
||||
view->setSortingEnabled(true);
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
|
||||
view->setDragEnabled(true);
|
||||
view->setAcceptDrops(true);
|
||||
view->setDropIndicatorShown(true);
|
||||
view->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
#if QT_VERSION < 0x050000
|
||||
view->header()->setResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
view->header()->setSectionResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->addWidget(view);
|
||||
|
|
@ -27,7 +38,7 @@ WndSets::WndSets(QWidget *parent)
|
|||
setCentralWidget(centralWidget);
|
||||
|
||||
setWindowTitle(tr("Edit sets"));
|
||||
resize(400, 400);
|
||||
resize(700, 400);
|
||||
}
|
||||
|
||||
WndSets::~WndSets()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue