summaryrefslogtreecommitdiffstats
path: root/academic/scidavis/fix-sf377-all-colors-turn-to-black-after-reload-of-project.patch
blob: 8e7a74cb439b787e29ad88268e6b99d8874333c5 (plain)
diff --git a/libscidavis/src/ApplicationWindow.cpp b/libscidavis/src/ApplicationWindow.cpp
index 534c12ac..b203c705 100644
--- a/libscidavis/src/ApplicationWindow.cpp
+++ b/libscidavis/src/ApplicationWindow.cpp
@@ -9611,7 +9611,7 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
 
                       CurveLayout cl;
                       cl.connectType=curve[4].toInt();
-                      cl.lCol=curve[5].toUInt();
+                      cl.lCol=COLORUINT(curve[5]);
                       if (d_file_version <= 89)
                         cl.lCol = convertOldToNewColorIndex(cl.lCol);
                       cl.lStyle=curve[6].toInt();
@@ -9622,7 +9622,7 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
                       else
                         cl.sType=curve[9].toInt();
 
-                      cl.symCol=curve[10].toUInt();
+                      cl.symCol=COLORUINT(curve[10]);
                       if (d_file_version <= 89)
                         cl.symCol = convertOldToNewColorIndex(cl.symCol);
                       if (curve[11]=="-1")
@@ -9630,12 +9630,12 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
                       else
                       {
                         cl.symbolFill = true;
-                        cl.fillCol=curve[11].toUInt();
+                        cl.fillCol=COLORUINT(curve[11]);
                       }
                       if (d_file_version <= 89)
                         cl.fillCol = convertOldToNewColorIndex(cl.fillCol);
                       cl.filledArea=curve[12].toInt();
-                      cl.aCol=curve[13].toUInt();
+                      cl.aCol=COLORUINT(curve[13]);
                       if (d_file_version <= 89)
                         cl.aCol = convertOldToNewColorIndex(cl.aCol);
                       cl.aStyle=curve[14].toInt();
@@ -9755,21 +9755,21 @@ Graph* ApplicationWindow::openGraph(ApplicationWindow* app, MultiLayer *plot,
 			QStringList curve = s.split("\t");
 			CurveLayout cl;
 			cl.connectType=curve[6].toInt();
-			cl.lCol=curve[7].toUInt();
+			cl.lCol=COLORUINT(curve[7]);
 			cl.lStyle=curve[8].toInt();
 			cl.lWidth=curve[9].toInt();
 			cl.sSize=curve[10].toInt();
 			cl.sType=curve[11].toInt();
-			cl.symCol=curve[12].toUInt();
+			cl.symCol=COLORUINT(curve[12]);
 			if (curve[13]=="-1")
 				cl.symbolFill = false;
 			else
 			{
 				cl.symbolFill = true;
-				cl.fillCol=curve[13].toUInt();
+				cl.fillCol=COLORUINT(curve[13]);
 			}
 			cl.filledArea=curve[14].toInt();
-			cl.aCol=curve[15].toUInt();
+			cl.aCol=COLORUINT(curve[15]);
 			cl.aStyle=curve[16].toInt();
 			int current_index = 17;
 			if(curve.count() < 16)
diff --git a/libscidavis/src/ColorButton.h b/libscidavis/src/ColorButton.h
index e826dff6..42351f99 100644
--- a/libscidavis/src/ColorButton.h
+++ b/libscidavis/src/ColorButton.h
@@ -42,6 +42,7 @@ static inline QString COLORVALUE( QString s ) { return s; }
 static inline QString COLORNAME( QColor c ) { return ('#'+QString::number(c.rgba(),16)); }
 static inline QString COLORVALUE( QString s ) { if ((s[0]=='#') && (s.size()==9)) return s.remove(1,2); else return s; }
 #endif
+static inline uint    COLORUINT( QString s ) { if (s[0]=='#') return s.remove(0,1).toUInt(nullptr,16); else return s.toUInt(); }
 
 //! A button used for color selection
 /**