From: Soeren Apel Date: Sat, 27 Oct 2018 15:06:07 +0000 (+0200) Subject: SignalBase: Work around QColor serialization bug on OSX X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6c892c63e9cece71466ea6e2459d00b50ba18352;p=pulseview.git SignalBase: Work around QColor serialization bug on OSX --- diff --git a/pv/data/signalbase.cpp b/pv/data/signalbase.cpp index 9f35725f..670de498 100644 --- a/pv/data/signalbase.cpp +++ b/pv/data/signalbase.cpp @@ -450,7 +450,7 @@ void SignalBase::save_settings(QSettings &settings) const { settings.setValue("name", name()); settings.setValue("enabled", enabled()); - settings.setValue("color", color()); + settings.setValue("color", color().rgba()); settings.setValue("conversion_type", (int)conversion_type_); settings.setValue("conv_options", (int)(conversion_options_.size())); @@ -470,8 +470,15 @@ void SignalBase::restore_settings(QSettings &settings) if (settings.contains("enabled")) set_enabled(settings.value("enabled").toBool()); - if (settings.contains("color")) - set_color(settings.value("color").value()); + if (settings.contains("color")) { + QVariant value = settings.value("color"); + + // Workaround for Qt QColor serialization bug on OSX + if (((QMetaType::Type)(value.type()) == QMetaType::QColor) && value.isValid()) + set_color(value.value()); + else + set_color(QColor::fromRgba(value.value())); + } if (settings.contains("conversion_type")) set_conversion_type((ConversionType)settings.value("conversion_type").toInt());