mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Sets window: implemented save and restore buttons
This commit is contained in:
parent
ac43fa23b9
commit
f48f386f35
4 changed files with 48 additions and 3 deletions
|
|
@ -2,8 +2,9 @@
|
|||
#include "setsmodel.h"
|
||||
#include "main.h"
|
||||
#include <QTreeView>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QPushButton>
|
||||
|
||||
WndSets::WndSets(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
|
|
@ -30,8 +31,15 @@ WndSets::WndSets(QWidget *parent)
|
|||
view->header()->setSectionResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->addWidget(view);
|
||||
saveButton = new QPushButton(tr("Save sets order"));
|
||||
connect(saveButton, SIGNAL(clicked()), this, SLOT(actSave()));
|
||||
restoreButton = new QPushButton(tr("Restore saved sets order"));
|
||||
connect(restoreButton, SIGNAL(clicked()), this, SLOT(actRestore()));
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget(view, 0, 0, 1, 2);
|
||||
mainLayout->addWidget(saveButton, 1, 0, 1, 1);
|
||||
mainLayout->addWidget(restoreButton, 1, 1, 1, 1);
|
||||
|
||||
QWidget *centralWidget = new QWidget;
|
||||
centralWidget->setLayout(mainLayout);
|
||||
|
|
@ -44,3 +52,13 @@ WndSets::WndSets(QWidget *parent)
|
|||
WndSets::~WndSets()
|
||||
{
|
||||
}
|
||||
|
||||
void WndSets::actSave()
|
||||
{
|
||||
proxyModel->saveOrder();
|
||||
}
|
||||
|
||||
void WndSets::actRestore()
|
||||
{
|
||||
view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue