Qt: Fix cancel in LED colour selection

This commit is contained in:
Stenzek 2023-01-16 12:46:55 +10:00
parent c393db419e
commit e0ed76745e

View file

@ -39,7 +39,9 @@ void ColorPickerButton::onClicked()
const QColor initial(QColor::fromRgb(red, green, blue));
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;
const u32 new_rgb = (static_cast<u32>(selected.red()) << 16) | (static_cast<u32>(selected.green()) << 8) |