]> sigrok.org Git - pulseview.git/commitdiff
SignalBase: Make sure an invalid color isn't shown as "white"
authorSoeren Apel <redacted>
Sun, 28 Oct 2018 19:27:07 +0000 (20:27 +0100)
committerSoeren Apel <redacted>
Sun, 28 Oct 2018 19:27:07 +0000 (20:27 +0100)
While the color technically is black and not white, an alpha
value of 0 makes it appear as white.

pv/data/signalbase.cpp

index 670de49874326006f83b441074cc1d783c4767ae..78633de977706ac5947969f1138fb340562a170a 100644 (file)
@@ -474,10 +474,14 @@ void SignalBase::restore_settings(QSettings &settings)
                QVariant value = settings.value("color");
 
                // Workaround for Qt QColor serialization bug on OSX
                QVariant value = settings.value("color");
 
                // Workaround for Qt QColor serialization bug on OSX
-               if (((QMetaType::Type)(value.type()) == QMetaType::QColor) && value.isValid())
+               if ((QMetaType::Type)(value.type()) == QMetaType::QColor)
                        set_color(value.value<QColor>());
                else
                        set_color(QColor::fromRgba(value.value<uint32_t>()));
                        set_color(value.value<QColor>());
                else
                        set_color(QColor::fromRgba(value.value<uint32_t>()));
+
+               // A color with an alpha value of 0 makes the signal marker invisible
+               if (color() == QColor(0, 0, 0, 0))
+                       set_color(Qt::gray);
        }
 
        if (settings.contains("conversion_type"))
        }
 
        if (settings.contains("conversion_type"))