diff data/model/PathModel.h @ 1677:f97d64b8674f single-point

Make XmlExportables store their export IDs and always obtain a new one, avoiding reuse when an object is allocated at the same heap location as a previous one. This makes the ID system stable enough to be used in the export tests.
author Chris Cannam
date Thu, 28 Mar 2019 11:55:02 +0000
parents 6804af71b7be
children 0d89abd631ac
line wrap: on
line diff
--- a/data/model/PathModel.h	Thu Mar 28 10:39:24 2019 +0000
+++ b/data/model/PathModel.h	Thu Mar 28 11:55:02 2019 +0000
@@ -167,6 +167,10 @@
     void toXml(QTextStream &out,
                        QString indent = "",
                        QString extraAttributes = "") const override {
+
+        // Our dataset doesn't have its own export ID, we just use
+        // ours. Actually any model could do that, since datasets
+        // aren't in the same id-space as models when re-read
         
         Model::toXml
             (out,
@@ -176,11 +180,11 @@
              .arg(m_resolution)
              .arg("true") // always true after model reaches 100% -
                           // subsequent points are always notified
-             .arg(getObjectExportId(&m_points))
+             .arg(getExportId())
              .arg(extraAttributes));
 
         out << indent << QString("<dataset id=\"%1\" dimensions=\"2\">\n")
-            .arg(getObjectExportId(&m_points));
+            .arg(getExportId());
         
         for (PathPoint p: m_points) {
             p.toXml(out, indent + "  ", "");