mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Adds Single-Click editions on the TableView
This is a linus request, adds a Single-click edition on the tableview to make it more consistent with the rest of the interface where edition is permitted. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
		
							parent
							
								
									bad91ef11c
								
							
						
					
					
						commit
						29b92e2fc5
					
				
					 2 changed files with 16 additions and 1 deletions
				
			
		|  | @ -78,7 +78,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), | ||||||
| 	addWeight->setEnabled(false); | 	addWeight->setEnabled(false); | ||||||
| 
 | 
 | ||||||
| 	connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), ui->cylinders->model(), SLOT(remove(QModelIndex))); | 	connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), ui->cylinders->model(), SLOT(remove(QModelIndex))); | ||||||
|  | 	connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); | ||||||
| 	connect(ui->weights, SIGNAL(clicked(QModelIndex)), ui->weights->model(), SLOT(remove(QModelIndex))); | 	connect(ui->weights, SIGNAL(clicked(QModelIndex)), ui->weights->model(), SLOT(remove(QModelIndex))); | ||||||
|  | 	connect(ui->weights, SIGNAL(clicked(QModelIndex)), this, SLOT(editWeigthWidget(QModelIndex))); | ||||||
| 
 | 
 | ||||||
| 	QFontMetrics metrics(defaultModelFont()); | 	QFontMetrics metrics(defaultModelFont()); | ||||||
| 	QFontMetrics metrics2(font()); | 	QFontMetrics metrics2(font()); | ||||||
|  | @ -532,5 +534,16 @@ void MainTab::initialUiSetup() | ||||||
| 			ui->weights->resizeColumnToContents(i); | 			ui->weights->resizeColumnToContents(i); | ||||||
| 	} | 	} | ||||||
| 	s.endGroup(); | 	s.endGroup(); | ||||||
| 
 | } | ||||||
|  | 
 | ||||||
|  | void MainTab::editCylinderWidget(const QModelIndex& index) | ||||||
|  | { | ||||||
|  | 	if (index.column() != CylindersModel::REMOVE) | ||||||
|  | 		ui->cylinders->edit(index); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MainTab::editWeigthWidget(const QModelIndex& index) | ||||||
|  | { | ||||||
|  | 	if (index.column() != WeightModel::REMOVE) | ||||||
|  | 		ui->weights->edit(index); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -60,6 +60,8 @@ public slots: | ||||||
| 	void on_rating_valueChanged(int value); | 	void on_rating_valueChanged(int value); | ||||||
| 	void on_visibility_valueChanged(int value); | 	void on_visibility_valueChanged(int value); | ||||||
| 	void tabChanged(int idx); | 	void tabChanged(int idx); | ||||||
|  | 	void editCylinderWidget(const QModelIndex& index); | ||||||
|  | 	void editWeigthWidget(const QModelIndex& index); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 	Ui::MainTab *ui; | 	Ui::MainTab *ui; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue