mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 21:30: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/util/logger.hpp> | ||||
| 
 | ||||
| #include <QSortFilterProxyModel> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  | @ -17,8 +19,14 @@ static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | |||
| class RadarSiteDialogImpl | ||||
| { | ||||
| public: | ||||
|    explicit RadarSiteDialogImpl() {} | ||||
|    explicit RadarSiteDialogImpl() : | ||||
|        radarSiteModel_ {nullptr}, proxyModel_ {nullptr} | ||||
|    { | ||||
|    } | ||||
|    ~RadarSiteDialogImpl() = default; | ||||
| 
 | ||||
|    model::RadarSiteModel* radarSiteModel_; | ||||
|    QSortFilterProxyModel* proxyModel_; | ||||
| }; | ||||
| 
 | ||||
| RadarSiteDialog::RadarSiteDialog(QWidget* parent) : | ||||
|  | @ -28,10 +36,12 @@ RadarSiteDialog::RadarSiteDialog(QWidget* parent) : | |||
| { | ||||
|    ui->setupUi(this); | ||||
| 
 | ||||
|    model::RadarSiteModel* radarSiteModel = new model::RadarSiteModel(this); | ||||
|    ui->radarSiteView->setModel(radarSiteModel); | ||||
|    p->radarSiteModel_ = new model::RadarSiteModel(this); | ||||
|    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); | ||||
|    } | ||||
|  |  | |||
|  | @ -19,6 +19,9 @@ | |||
|      <property name="indentation"> | ||||
|       <number>0</number> | ||||
|      </property> | ||||
|      <property name="sortingEnabled"> | ||||
|       <bool>true</bool> | ||||
|      </property> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat