mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Printing: update preview on apply settings
On update call Printer to render on the QPixmap. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
		
							parent
							
								
									f1615e725c
								
							
						
					
					
						commit
						d705cb34bb
					
				
					 2 changed files with 12 additions and 5 deletions
				
			
		|  | @ -29,7 +29,16 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, | |||
| 	} | ||||
| 
 | ||||
| 	ui->plainTextEdit->setPlainText(grantlee_template); | ||||
| 	updatePreview(); | ||||
| } | ||||
| 
 | ||||
| TemplateEdit::~TemplateEdit() | ||||
| { | ||||
| 	delete ui; | ||||
| } | ||||
| 
 | ||||
| void TemplateEdit::updatePreview() | ||||
| { | ||||
| 	int width = ui->label->width(); | ||||
| 	int height = ui->label->height(); | ||||
| 	QPixmap map(width * 2, height * 2); | ||||
|  | @ -39,11 +48,6 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, | |||
| 	ui->label->setPixmap(map.scaled(width, height, Qt::IgnoreAspectRatio)); | ||||
| } | ||||
| 
 | ||||
| TemplateEdit::~TemplateEdit() | ||||
| { | ||||
| 	delete ui; | ||||
| } | ||||
| 
 | ||||
| void TemplateEdit::on_fontsize_valueChanged(int font_size) | ||||
| { | ||||
| 	newTemplateOptions.font_size = font_size; | ||||
|  | @ -90,6 +94,7 @@ void TemplateEdit::on_buttonBox_clicked(QAbstractButton *button) | |||
| 		break; | ||||
| 	case QDialogButtonBox::Apply: | ||||
| 		saveSettings(); | ||||
| 		updatePreview(); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -33,6 +33,8 @@ private: | |||
| 	struct print_options *printOptions; | ||||
| 	QString grantlee_template; | ||||
| 	void saveSettings(); | ||||
| 	void updatePreview(); | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| #endif // TEMPLATEEDIT_H
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue