diff layer/TimeValueLayer.cpp @ 11:2d5005f2b3d9

* Rework handling of layer properties in file I/O -- we now get the individual layers to load and save them rather than doing it via generic property lists in the base class, so as to ensure we read and write meaningful values rather than generic int values requiring conversion.
author Chris Cannam
date Thu, 19 Jan 2006 12:54:38 +0000
parents 8f5b812baaee
children 01849cd277e6
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Tue Jan 17 17:45:55 2006 +0000
+++ b/layer/TimeValueLayer.cpp	Thu Jan 19 12:54:38 2006 +0000
@@ -287,6 +287,7 @@
 
     SparseTimeValueModel::PointList points(m_model->getPoints
 					   (frame0, frame1));
+    if (points.empty()) return;
 
     paint.setPen(m_colour);
 
@@ -438,6 +439,23 @@
 			      .arg(encodeColour(m_colour)).arg(m_plotStyle));
 }
 
+void
+TimeValueLayer::setProperties(const QXmlAttributes &attributes)
+{
+    QString colourSpec = attributes.value("colour");
+    if (colourSpec != "") {
+	QColor colour(colourSpec);
+	if (colour.isValid()) {
+	    setBaseColour(QColor(colourSpec));
+	}
+    }
+
+    bool ok;
+    PlotStyle style = (PlotStyle)
+	attributes.value("plotStyle").toInt(&ok);
+    if (ok) setPlotStyle(style);
+}
+
 
 #ifdef INCLUDE_MOCFILES
 #include "TimeValueLayer.moc.cpp"