Qt: Save sorting order
This commit is contained in:
parent
ab5a5ee3ea
commit
8ca6814673
|
@ -14,6 +14,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
#include <QSettings>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
@ -86,6 +87,13 @@ void GameList::MakeTableView()
|
||||||
m_table->setColumnHidden(GameListModel::COL_RATING, !SConfig::GetInstance().m_showStateColumn);
|
m_table->setColumnHidden(GameListModel::COL_RATING, !SConfig::GetInstance().m_showStateColumn);
|
||||||
|
|
||||||
QHeaderView* hor_header = m_table->horizontalHeader();
|
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_PLATFORM, QHeaderView::ResizeToContents);
|
||||||
hor_header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::ResizeToContents);
|
hor_header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::ResizeToContents);
|
||||||
hor_header->setSectionResizeMode(GameListModel::COL_ID, 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);
|
progress_dialog->setValue(percent * 100);
|
||||||
return !progress_dialog->wasCanceled();
|
return !progress_dialog->wasCanceled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameList::OnHeaderViewChanged()
|
||||||
|
{
|
||||||
|
QSettings().setValue(QStringLiteral("tableheader/state"),
|
||||||
|
m_table->horizontalHeader()->saveState());
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ private slots:
|
||||||
void UninstallWAD();
|
void UninstallWAD();
|
||||||
void ExportWiiSave();
|
void ExportWiiSave();
|
||||||
void CompressISO();
|
void CompressISO();
|
||||||
|
void OnHeaderViewChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void GameSelected();
|
void GameSelected();
|
||||||
|
|
Loading…
Reference in New Issue