summaryrefslogtreecommitdiff
path: root/src/gui/graphicsview/qgraph_p.h
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-06-24 16:45:18 +0200
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-07-22 15:04:34 -0300
commitca3ab7615d08742cb81dcc6fab723b89355ac82a (patch)
treeb368f5b6b6ad266a37bea5f68e608898f6f748f5 /src/gui/graphicsview/qgraph_p.h
parentd3d455e6d019a381b338c24b3c2593b2e12215cb (diff)
downloadqt4-tools-ca3ab7615d08742cb81dcc6fab723b89355ac82a.tar.gz
Implemented parallel simplification, some bugfixes of the previous code.
Currently, the code is not in effect for the simplex solver kicks in (it crashes), but it is in effect for each layout to check that simplification and restoring the simplification back again works. This is currently done in calculateGraphs() Parts of the code does not read well, especially the detection of the sequential chunks.
Diffstat (limited to 'src/gui/graphicsview/qgraph_p.h')
-rw-r--r--src/gui/graphicsview/qgraph_p.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h
index 63ba53b155..9128df8795 100644
--- a/src/gui/graphicsview/qgraph_p.h
+++ b/src/gui/graphicsview/qgraph_p.h
@@ -68,9 +68,16 @@ public:
return const_iterator(this,false);
}
+ /*!
+ * \internal
+ *
+ * If there is an edge between \a first and \a second, it will return a structure
+ * containing the data associated with the edge, otherwise it will return 0.
+ *
+ */
EdgeData *edgeData(Vertex* first, Vertex* second) {
- Q_ASSERT(m_graph.value(first));
- return m_graph.value(first)->value(second);
+ QHash<Vertex *, EdgeData *> *row = m_graph.value(first);
+ return row ? row->value(second) : 0;
}
void createEdge(Vertex *first, Vertex *second, EdgeData *data)
@@ -93,8 +100,10 @@ public:
{
// Removes a bidirectional edge
EdgeData *data = edgeData(first, second);
- removeDirectedEdge(first, second);
- removeDirectedEdge(second, first);
+ if (data) {
+ removeDirectedEdge(first, second);
+ removeDirectedEdge(second, first);
+ }
return data;
}
@@ -140,7 +149,6 @@ public:
.arg(data->maxSize)
;
}
-
}
strVertices += QString::fromAscii("%1 [label=\"%2\"]\n").arg(v->toString()).arg(v->toString());
}