Qt: Fix cancel in LED colour selection
This commit is contained in:
parent
c393db419e
commit
e0ed76745e
|
@ -39,7 +39,9 @@ void ColorPickerButton::onClicked()
|
||||||
|
|
||||||
const QColor initial(QColor::fromRgb(red, green, blue));
|
const QColor initial(QColor::fromRgb(red, green, blue));
|
||||||
const QColor selected(QColorDialog::getColor(initial, QtUtils::GetRootWidget(this), tr("Select LED Color")));
|
const QColor selected(QColorDialog::getColor(initial, QtUtils::GetRootWidget(this), tr("Select LED Color")));
|
||||||
if (initial == selected)
|
|
||||||
|
// QColorDialog returns Invalid on cancel, and apparently initial == Invalid is true...
|
||||||
|
if (!selected.isValid() || initial == selected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const u32 new_rgb = (static_cast<u32>(selected.red()) << 16) | (static_cast<u32>(selected.green()) << 8) |
|
const u32 new_rgb = (static_cast<u32>(selected.red()) << 16) | (static_cast<u32>(selected.green()) << 8) |
|
||||||
|
|
Loading…
Reference in New Issue