Stats: enable sorting when the table is flipped.

This allows sorting the players by rank, for example.
This commit is contained in:
Olivier Teulière 2012-11-07 14:44:50 +01:00
parent fa55eab82e
commit c89e91010c

View file

@ -21,6 +21,7 @@
#include <QtGui/QTableView>
#include <QtGui/QHeaderView>
#include <QtGui/QStandardItemModel>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QAction>
@ -457,10 +458,15 @@ void StatsWidget::lockSizesChanged(bool checked)
void StatsWidget::flipTable()
{
bool flipped = m_table->model() != m_model;
m_table->setSortingEnabled(!flipped);
if (flipped)
m_table->setModel(m_model);
else
m_table->setModel(m_flippedModel);
{
QSortFilterProxyModel *proxy = new QSortFilterProxyModel;
proxy->setSourceModel(m_flippedModel);
m_table->setModel(proxy);
}
refresh();
}