Mercurial > hg > svgui
diff view/View.cpp @ 316:c0b9eec70639
* Make XmlExportable::toXml the function that is universally overridden (and
pure virtual) instead of toXmlString. Tidies up some classes, notably the
model classes, significantly. Closes #1794561.
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 10:15:07 +0000 |
parents | c30a7cd29f4a |
children | 984c1975f1ff |
line wrap: on
line diff
--- a/view/View.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/view/View.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -30,6 +30,7 @@ #include <QRect> #include <QApplication> #include <QProgressDialog> +#include <QTextStream> #include <iostream> #include <cassert> @@ -2128,20 +2129,19 @@ return QSize(x1 - x0, height()); } -QString -View::toXmlString(QString indent, QString extraAttributes) const +void +View::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; + stream << indent; - s += indent; - - s += QString("<view " - "centre=\"%1\" " - "zoom=\"%2\" " - "followPan=\"%3\" " - "followZoom=\"%4\" " - "tracking=\"%5\" " - " %6>\n") + stream << QString("<view " + "centre=\"%1\" " + "zoom=\"%2\" " + "followPan=\"%3\" " + "followZoom=\"%4\" " + "tracking=\"%5\" " + " %6>\n") .arg(m_centreFrame) .arg(m_zoomLevel) .arg(m_followPan) @@ -2152,14 +2152,12 @@ for (size_t i = 0; i < m_layers.size(); ++i) { bool visible = !m_layers[i]->isLayerDormant(this); - s += m_layers[i]->toBriefXmlString(indent + " ", - QString("visible=\"%1\"") - .arg(visible ? "true" : "false")); + m_layers[i]->toBriefXml(stream, indent + " ", + QString("visible=\"%1\"") + .arg(visible ? "true" : "false")); } - s += indent + "</view>\n"; - - return s; + stream << indent + "</view>\n"; } ViewPropertyContainer::ViewPropertyContainer(View *v) :