Skip to content

Commit

Permalink
refs #6500. Check valid colour before setting.
Browse files Browse the repository at this point in the history
Check that a valid colour has been chosen before setting anything. If cancel is clicked, the colour fetched will not be valid.
  • Loading branch information
OwenArnold committed Jul 25, 2013
1 parent d0bd01a commit 6225f87
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Code/Mantid/MantidQt/SliceViewer/src/PeaksWorkspaceWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ namespace MantidQt
void PeaksWorkspaceWidget::onForegroundColourClicked()
{
QColorDialog colourDlg;
colourDlg.result();
QColor selectedColour = colourDlg.getColor();

ui.btnPeakColor->setBackgroundColor(selectedColour);
emit peakColourChanged(this->m_ws, selectedColour);
if(selectedColour.isValid() )
{
ui.btnPeakColor->setBackgroundColor(selectedColour);
emit peakColourChanged(this->m_ws, selectedColour);
}
}

/**
Expand All @@ -137,8 +140,11 @@ namespace MantidQt
{
QColorDialog colourDlg;
QColor selectedColour = colourDlg.getColor();
ui.btnBackgroundColor->setBackgroundColor(selectedColour);
emit backgroundColourChanged(this->m_ws, selectedColour);
if(selectedColour.isValid() )
{
ui.btnBackgroundColor->setBackgroundColor(selectedColour);
emit backgroundColourChanged(this->m_ws, selectedColour);
}
}

/**
Expand Down

0 comments on commit 6225f87

Please sign in to comment.