mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Printing: don't save invalid colors
When QColorDialog is closed with 'Cancel' button, it returns invalid color that must be discarded. So check if color is valid to prevent replacing the current color with black. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
parent
342479586d
commit
55f09f0106
1 changed files with 15 additions and 9 deletions
|
@ -168,24 +168,30 @@ void TemplateEdit::colorSelect(QAbstractButton *button)
|
|||
switch (btnGroup->id(button)) {
|
||||
case 1:
|
||||
color = QColorDialog::getColor(newTemplateOptions.color_palette.color1, this);
|
||||
newTemplateOptions.color_palette.color1 = color;
|
||||
if (color.isValid()) {
|
||||
newTemplateOptions.color_palette.color1 = color;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
color = QColorDialog::getColor(newTemplateOptions.color_palette.color2, this);
|
||||
newTemplateOptions.color_palette.color2 = color;
|
||||
break;
|
||||
if (color.isValid()) {
|
||||
newTemplateOptions.color_palette.color2 = color;
|
||||
} break;
|
||||
case 3:
|
||||
color = QColorDialog::getColor(newTemplateOptions.color_palette.color3, this);
|
||||
newTemplateOptions.color_palette.color3 = color;
|
||||
break;
|
||||
if (color.isValid()) {
|
||||
newTemplateOptions.color_palette.color3 = color;
|
||||
} break;
|
||||
case 4:
|
||||
color = QColorDialog::getColor(newTemplateOptions.color_palette.color4, this);
|
||||
newTemplateOptions.color_palette.color4 = color;
|
||||
break;
|
||||
if (color.isValid()) {
|
||||
newTemplateOptions.color_palette.color4 = color;
|
||||
} break;
|
||||
case 5:
|
||||
color = QColorDialog::getColor(newTemplateOptions.color_palette.color5, this);
|
||||
newTemplateOptions.color_palette.color5 = color;
|
||||
break;
|
||||
if (color.isValid()) {
|
||||
newTemplateOptions.color_palette.color5 = color;
|
||||
} break;
|
||||
}
|
||||
newTemplateOptions.color_palette_index = CUSTOM;
|
||||
updatePreview();
|
||||
|
|
Loading…
Add table
Reference in a new issue