mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:13:23 +00:00
Printing: add apply button to TemplateEdit class
Add apply button to the dialog, Update the preview after applying the new settings. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
7ca311ae85
commit
f1615e725c
3 changed files with 19 additions and 3 deletions
|
@ -64,7 +64,7 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index)
|
|||
newTemplateOptions.color_palette_index = index;
|
||||
}
|
||||
|
||||
void TemplateEdit::on_TemplateEdit_finished(int result)
|
||||
void TemplateEdit::saveSettings()
|
||||
{
|
||||
if ((*templateOptions) != newTemplateOptions || grantlee_template.compare(ui->plainTextEdit->toPlainText())) {
|
||||
QMessageBox msgBox;
|
||||
|
@ -78,3 +78,18 @@ void TemplateEdit::on_TemplateEdit_finished(int result)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TemplateEdit::on_buttonBox_clicked(QAbstractButton *button)
|
||||
{
|
||||
QDialogButtonBox::StandardButton standardButton = ui->buttonBox->standardButton(button);
|
||||
switch (standardButton) {
|
||||
case QDialogButtonBox::Ok:
|
||||
saveSettings();
|
||||
break;
|
||||
case QDialogButtonBox::Cancel:
|
||||
break;
|
||||
case QDialogButtonBox::Apply:
|
||||
saveSettings();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ private slots:
|
|||
|
||||
void on_colorpalette_currentIndexChanged(int index);
|
||||
|
||||
void on_TemplateEdit_finished(int result);
|
||||
void on_buttonBox_clicked(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
Ui::TemplateEdit *ui;
|
||||
|
@ -32,6 +32,7 @@ private:
|
|||
struct template_options newTemplateOptions;
|
||||
struct print_options *printOptions;
|
||||
QString grantlee_template;
|
||||
void saveSettings();
|
||||
};
|
||||
|
||||
#endif // TEMPLATEEDIT_H
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
|
|
Loading…
Add table
Reference in a new issue