summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout_p.h
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-10-28 14:17:18 (GMT)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-10-28 14:17:18 (GMT)
commite77732c9b0c8b8313138306d723f5227cfbc124d (patch)
treecd5048827c7a6d4f5f35b43c307ff17daae8dd5e /src/gui/graphicsview/qgraphicsanchorlayout_p.h
parent1607216cc6292ef9a4af68ce6d29dc79fffea92c (diff)
downloadQt-e77732c9b0c8b8313138306d723f5227cfbc124d.zip
Qt-e77732c9b0c8b8313138306d723f5227cfbc124d.tar.gz
Qt-e77732c9b0c8b8313138306d723f5227cfbc124d.tar.bz2
QGAL: set the orientation bit for complex anchors
Sets the orientation bit for complex anchors. This is being done in the constructor, and I did a minor refactor to make the constructor of SequentialAnchor take the list of vertices and anchors that it is simplifying. Before that we set one of those directly in the structure and the other via a setter function. The tests were passing because right now, complex anchors do not use the orientation bit, while some Normal anchors use in the refreshSizeHints() function (to get either the width() or height() of an item). Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.h')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 8eb65c5..600b06c 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -223,11 +223,13 @@ inline QString AnchorData::toString() const
struct SequentialAnchorData : public AnchorData
{
- SequentialAnchorData() : AnchorData()
+ SequentialAnchorData(const QVector<AnchorVertex *> &vertices, const QVector<AnchorData *> &edges)
+ : AnchorData(), m_children(vertices), m_edges(edges)
{
type = AnchorData::Sequential;
+ orientation = m_edges.at(0)->orientation;
#ifdef QT_DEBUG
- name = QLatin1String("SequentialAnchorData");
+ name = QString::fromAscii("%1 -- %2").arg(vertices.first()->toString(), vertices.last()->toString());
#endif
}
@@ -236,14 +238,6 @@ struct SequentialAnchorData : public AnchorData
bool refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true);
- void setVertices(const QVector<AnchorVertex*> &vertices)
- {
- m_children = vertices;
-#ifdef QT_DEBUG
- name = QString::fromAscii("%1 -- %2").arg(vertices.first()->toString(), vertices.last()->toString());
-#endif
- }
-
QVector<AnchorVertex*> m_children; // list of vertices in the sequence
QVector<AnchorData*> m_edges; // keep the list of edges too.
};
@@ -254,6 +248,7 @@ struct ParallelAnchorData : public AnchorData
: AnchorData(), firstEdge(first), secondEdge(second)
{
type = AnchorData::Parallel;
+ orientation = first->orientation;
// ### Those asserts force that both child anchors have the same direction,
// but can't we simplify a pair of anchors in opposite directions?