mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:50:05 +00:00
Enable sorting of the radar site list
This commit is contained in:
parent
dfa81e75f6
commit
2acd8be063
2 changed files with 17 additions and 4 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
#include <scwx/qt/model/radar_site_model.hpp>
|
#include <scwx/qt/model/radar_site_model.hpp>
|
||||||
#include <scwx/util/logger.hpp>
|
#include <scwx/util/logger.hpp>
|
||||||
|
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx
|
||||||
{
|
{
|
||||||
namespace qt
|
namespace qt
|
||||||
|
|
@ -17,8 +19,14 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
class RadarSiteDialogImpl
|
class RadarSiteDialogImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RadarSiteDialogImpl() {}
|
explicit RadarSiteDialogImpl() :
|
||||||
|
radarSiteModel_ {nullptr}, proxyModel_ {nullptr}
|
||||||
|
{
|
||||||
|
}
|
||||||
~RadarSiteDialogImpl() = default;
|
~RadarSiteDialogImpl() = default;
|
||||||
|
|
||||||
|
model::RadarSiteModel* radarSiteModel_;
|
||||||
|
QSortFilterProxyModel* proxyModel_;
|
||||||
};
|
};
|
||||||
|
|
||||||
RadarSiteDialog::RadarSiteDialog(QWidget* parent) :
|
RadarSiteDialog::RadarSiteDialog(QWidget* parent) :
|
||||||
|
|
@ -28,10 +36,12 @@ RadarSiteDialog::RadarSiteDialog(QWidget* parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
model::RadarSiteModel* radarSiteModel = new model::RadarSiteModel(this);
|
p->radarSiteModel_ = new model::RadarSiteModel(this);
|
||||||
ui->radarSiteView->setModel(radarSiteModel);
|
p->proxyModel_ = new QSortFilterProxyModel(this);
|
||||||
|
p->proxyModel_->setSourceModel(p->radarSiteModel_);
|
||||||
|
ui->radarSiteView->setModel(p->proxyModel_);
|
||||||
|
|
||||||
for (int column = 0; column < radarSiteModel->columnCount(); column++)
|
for (int column = 0; column < p->radarSiteModel_->columnCount(); column++)
|
||||||
{
|
{
|
||||||
ui->radarSiteView->resizeColumnToContents(column);
|
ui->radarSiteView->resizeColumnToContents(column);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
<property name="indentation">
|
<property name="indentation">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue