diff options
-rw-r--r-- | qt-ui/templateedit.cpp | 15 | ||||
-rw-r--r-- | qt-ui/templateedit.h | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 2d09cb947..bd4763107 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -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; } } diff --git a/qt-ui/templateedit.h b/qt-ui/templateedit.h index 9b6d9167f..21cbc0321 100644 --- a/qt-ui/templateedit.h +++ b/qt-ui/templateedit.h @@ -33,6 +33,8 @@ private: struct print_options *printOptions; QString grantlee_template; void saveSettings(); + void updatePreview(); + }; #endif // TEMPLATEEDIT_H |