From f981cf2ce04aacbe28bed9804df20621bbeba142 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 20 Sep 2020 12:03:08 +0200 Subject: [PATCH] Do nothing if color dialog is closed using Escape button --- .../Commands/RicThemeColorEditorFeature.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/Commands/RicThemeColorEditorFeature.cpp b/ApplicationCode/Commands/RicThemeColorEditorFeature.cpp index 52bbcff31b..7350d47edd 100644 --- a/ApplicationCode/Commands/RicThemeColorEditorFeature.cpp +++ b/ApplicationCode/Commands/RicThemeColorEditorFeature.cpp @@ -121,11 +121,14 @@ void RicThemeColorEditorFeature::onActionTriggered( bool isChecked ) &QPushButton::clicked, [this, variableValueMap, variableName, theme, editor, widget, colorBox]() -> void { QColor color = QColorDialog::getColor( colorBox->palette().color( QPalette::Button ), widget ); - colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( color.name() ) ); - colorBox->style()->unpolish( colorBox ); - colorBox->style()->polish( colorBox ); - RiuGuiTheme::changeVariableValue( theme, variableName, color.name() ); - editor->setPlainText( RiuGuiTheme::applyVariableValueMapToStyleSheet( theme ) ); + if ( color.isValid() ) + { + colorBox->setStyleSheet( QString( "background-color: %0;" ).arg( color.name() ) ); + colorBox->style()->unpolish( colorBox ); + colorBox->style()->polish( colorBox ); + RiuGuiTheme::changeVariableValue( theme, variableName, color.name() ); + editor->setPlainText( RiuGuiTheme::applyVariableValueMapToStyleSheet( theme ) ); + } } ); innerLayout->addWidget( colorBox, row++, column + 1 ); if ( row == 10 )