diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-06-03 10:58:07 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-07-22 18:04:23 (GMT) |
commit | 072a9595a308df9b8e7a547c370ce54ab5af6ed4 (patch) | |
tree | bc95701fb6e200b1317cf8d6ea7ae490ecca71ce /src/gui/graphicsview/qgraphicsanchorlayout.cpp | |
parent | b58d43e407029f19d313cdc2314cf114c572f692 (diff) | |
download | Qt-072a9595a308df9b8e7a547c370ce54ab5af6ed4.zip Qt-072a9595a308df9b8e7a547c370ce54ab5af6ed4.tar.gz Qt-072a9595a308df9b8e7a547c370ce54ab5af6ed4.tar.bz2 |
Some cleanup - improve dot dumper.
The previous dumper relied on traversal of the graph, which meant that
it would not output the nodes that were not connected to the "main"
graph. Due to this, we cannot rely on traversal, so instead we must
iterate through all the vertices of the graph. As an added bonus the
code gets simpler :-)
There was also a problem with the previous dumper, since it dumped
two "digraph" elements into one file. Graphwiz (win32) did not handle
that. Instead just dump all the nodes and all the connections, both
horizontal and vertical ones. The horizontal and vertical connections
are never connected anyway, so the result will be two separate graphs
when it is rendered by graphwiz.
Also renamed firstVertex to rootVertex and simplified it.
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index ba3ba2a..1a72ace 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -254,10 +254,10 @@ void QGraphicsAnchorLayout::dumpGraph() if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) qWarning("Could not write to %s", file.fileName().toLocal8Bit().constData()); + QString str = QString::fromAscii("digraph anchorlayout {\nnode [shape=\"rect\"]\n%1}"); QString dotContents = d->graph[0].serializeToDot(); - file.write(dotContents.toLocal8Bit()); - dotContents = d->graph[1].serializeToDot(); - file.write(dotContents.toLocal8Bit()); + dotContents += d->graph[1].serializeToDot(); + file.write(str.arg(dotContents).toLocal8Bit()); file.close(); } |