summaryrefslogtreecommitdiffstats
path: root/qt-ui/templateedit.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-11 12:50:14 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-20 15:28:12 +0300
commitd705cb34bb5a8d442b54784bb9105404bb304404 (patch)
tree8195635306c5c98b3a7767a0521a31a213d62cc5 /qt-ui/templateedit.cpp
parentf1615e725c7a5562b5fcaac2cd0701dae61b89ca (diff)
downloadsubsurface-d705cb34bb5a8d442b54784bb9105404bb304404.tar.gz
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>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r--qt-ui/templateedit.cpp15
1 files changed, 10 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;
}
}