Qt: Save sorting order

This commit is contained in:
spycrab 2017-07-12 18:25:54 +02:00
parent ab5a5ee3ea
commit 8ca6814673
2 changed files with 15 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QProgressDialog>
#include <QSettings>
#include <QUrl>
#include "Common/FileUtil.h"
@ -86,6 +87,13 @@ void GameList::MakeTableView()
m_table->setColumnHidden(GameListModel::COL_RATING, !SConfig::GetInstance().m_showStateColumn);
QHeaderView* hor_header = m_table->horizontalHeader();
connect(hor_header, &QHeaderView::sortIndicatorChanged, this, &GameList::OnHeaderViewChanged);
connect(hor_header, &QHeaderView::sectionResized, this, &GameList::OnHeaderViewChanged);
connect(hor_header, &QHeaderView::sectionCountChanged, this, &GameList::OnHeaderViewChanged);
hor_header->restoreState(QSettings().value(QStringLiteral("tableheader/state")).toByteArray());
hor_header->setSectionResizeMode(GameListModel::COL_PLATFORM, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::ResizeToContents);
hor_header->setSectionResizeMode(GameListModel::COL_ID, QHeaderView::ResizeToContents);
@ -445,3 +453,9 @@ static bool CompressCB(const std::string& text, float percent, void* ptr)
progress_dialog->setValue(percent * 100);
return !progress_dialog->wasCanceled();
}
void GameList::OnHeaderViewChanged()
{
QSettings().setValue(QStringLiteral("tableheader/state"),
m_table->horizontalHeader()->saveState());
}

View File

@ -39,6 +39,7 @@ private slots:
void UninstallWAD();
void ExportWiiSave();
void CompressISO();
void OnHeaderViewChanged();
signals:
void GameSelected();