Ignore change of colour if user has cancelled

Fixes #68, Bug report by Jim R
This commit is contained in:
Robin Stuart 2017-06-17 15:34:41 +01:00
parent 3a24230cd0
commit 37ac5e9c54

View File

@ -26,6 +26,7 @@
#include <QSettings> #include <QSettings>
#include <QClipboard> #include <QClipboard>
#include <QMimeData> #include <QMimeData>
#include <QColor>
#include "mainwindow.h" #include "mainwindow.h"
#include "datawindow.h" #include "datawindow.h"
@ -250,14 +251,24 @@ int MainWindow::open_sequence_dialog()
void MainWindow::on_fgcolor_clicked() void MainWindow::on_fgcolor_clicked()
{ {
m_fgcolor=QColorDialog::getColor(m_fgcolor,this); QColor temp = m_fgcolor;
update_preview(); m_fgcolor=QColorDialog::getColor(m_fgcolor,this,"Set foreground colour");
if (m_fgcolor.isValid()) {
update_preview();
} else {
m_fgcolor = temp;
}
} }
void MainWindow::on_bgcolor_clicked() void MainWindow::on_bgcolor_clicked()
{ {
m_bgcolor=QColorDialog::getColor(m_bgcolor,this); QColor temp = m_bgcolor;
update_preview(); m_bgcolor=QColorDialog::getColor(m_bgcolor,this,"Set background colour");
if (m_bgcolor.isValid()) {
update_preview();
} else {
m_bgcolor = temp;
}
} }
void MainWindow::change_print_scale() void MainWindow::change_print_scale()