mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: fix TemplateEdit color selection bug
When choosing a color from the QColorDialog, the TemplateEdit trigger to change the current selected template to be custom, and then changes the selected color. When the selected template is changed old template values are copied to the current template which results in incorrect behaviour. This is fixed by checking for the current editting state before setting the saved palettes as the current used palette. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
parent
dd7bae378e
commit
1d22bdc08c
2 changed files with 9 additions and 3 deletions
|
@ -33,6 +33,7 @@ TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions,
|
|||
connect(btnGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(colorSelect(QAbstractButton*)));
|
||||
|
||||
ui->plainTextEdit->setPlainText(grantlee_template);
|
||||
editingCustomColors = false;
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,10 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index)
|
|||
newTemplateOptions.color_palette = blueshades_colors;
|
||||
break;
|
||||
case CUSTOM: // custom
|
||||
newTemplateOptions.color_palette = custom_colors;
|
||||
if (!editingCustomColors)
|
||||
newTemplateOptions.color_palette = custom_colors;
|
||||
else
|
||||
editingCustomColors = false;
|
||||
break;
|
||||
}
|
||||
updatePreview();
|
||||
|
@ -148,6 +152,7 @@ void TemplateEdit::on_buttonBox_clicked(QAbstractButton *button)
|
|||
|
||||
void TemplateEdit::colorSelect(QAbstractButton *button)
|
||||
{
|
||||
editingCustomColors = true;
|
||||
// reset custom colors palette
|
||||
switch (newTemplateOptions.color_palette_index) {
|
||||
case SSRF_COLORS: // subsurface derived default colors
|
||||
|
@ -155,11 +160,11 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
|
|||
break;
|
||||
case ALMOND: // almond
|
||||
newTemplateOptions.color_palette = almond_colors;
|
||||
custom_colors = newTemplateOptions.color_palette;
|
||||
break;
|
||||
case BLUESHADES: // blueshades
|
||||
newTemplateOptions.color_palette = blueshades_colors;
|
||||
custom_colors = newTemplateOptions.color_palette;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ private slots:
|
|||
private:
|
||||
Ui::TemplateEdit *ui;
|
||||
QButtonGroup *btnGroup;
|
||||
bool editingCustomColors;
|
||||
struct template_options *templateOptions;
|
||||
struct template_options newTemplateOptions;
|
||||
struct print_options *printOptions;
|
||||
|
|
Loading…
Add table
Reference in a new issue