summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout_p.h
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-08-14 19:02:36 (GMT)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-08-14 19:27:58 (GMT)
commit6bd756353d1be7eadcf56f9c8415283d0d1c4cc3 (patch)
tree61f41b0ef49f5ce83851219797384dca488bf1ed /src/gui/graphicsview/qgraphicsanchorlayout_p.h
parent15f052a58cdd2c916d7194915dcd82912ba7097b (diff)
downloadQt-6bd756353d1be7eadcf56f9c8415283d0d1c4cc3.zip
Qt-6bd756353d1be7eadcf56f9c8415283d0d1c4cc3.tar.gz
Qt-6bd756353d1be7eadcf56f9c8415283d0d1c4cc3.tar.bz2
QGraphicsAnchorLayout: add both vertex information in anchor data
Make AnchorData aware of both vertices instead only one (the origin). This information is useful for many functions when working in simplified mode. Changed the name "origin" to "from", and add an "to" field. Also change setAnchorSizeHintsFromItems() and its helpers to make use of this information. In a later commit we will rollback to using recursion for initializing the size hint information. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout_p.h')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 3951910..eb1f8f6 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -130,18 +130,21 @@ struct AnchorData : public QSimplexVariable {
Parallel
};
AnchorData(qreal minimumSize, qreal preferredSize, qreal maximumSize)
- : QSimplexVariable(), minSize(minimumSize), prefSize(preferredSize),
+ : QSimplexVariable(), from(0), to(0),
+ minSize(minimumSize), prefSize(preferredSize),
maxSize(maximumSize), sizeAtMinimum(preferredSize),
sizeAtPreferred(preferredSize), sizeAtMaximum(preferredSize),
skipInPreferred(0), type(Normal), hasSize(true) {}
AnchorData(qreal size)
- : QSimplexVariable(), minSize(size), prefSize(size), maxSize(size),
+ : QSimplexVariable(), from(0), to(0),
+ minSize(size), prefSize(size), maxSize(size),
sizeAtMinimum(size), sizeAtPreferred(size), sizeAtMaximum(size),
skipInPreferred(0), type(Normal), hasSize(true) {}
AnchorData()
- : QSimplexVariable(), minSize(0), prefSize(0), maxSize(0),
+ : QSimplexVariable(), from(0), to(0),
+ minSize(0), prefSize(0), maxSize(0),
sizeAtMinimum(0), sizeAtPreferred(0), sizeAtMaximum(0),
skipInPreferred(0), type(Normal), hasSize(false) {}
@@ -153,7 +156,8 @@ struct AnchorData : public QSimplexVariable {
QString name;
// Anchor is semantically directed
- AnchorVertex *origin;
+ AnchorVertex *from;
+ AnchorVertex *to;
// Size restrictions of this edge. For anchors internal to items, these
// values are derived from the respective item size hints. For anchors
@@ -175,7 +179,8 @@ struct AnchorData : public QSimplexVariable {
uint hasSize : 1; // if false, get size from style.
protected:
AnchorData(Type type, qreal size = 0)
- : QSimplexVariable(), minSize(size), prefSize(size),
+ : QSimplexVariable(), from(0), to(0),
+ minSize(size), prefSize(size),
maxSize(size), sizeAtMinimum(size),
sizeAtPreferred(size), sizeAtMaximum(size),
skipInPreferred(0), type(type), hasSize(true) {}
@@ -214,8 +219,12 @@ struct ParallelAnchorData : public AnchorData
: AnchorData(AnchorData::Parallel),
firstEdge(first), secondEdge(second)
{
- Q_ASSERT(first->origin == second->origin);
- origin = first->origin;
+ // ### Those asserts force that both child anchors have the same direction,
+ // but can't we simplify a pair of anchors in opposite directions?
+ Q_ASSERT(first->from == second->from);
+ Q_ASSERT(first->to == second->to);
+ from = first->from;
+ to = first->to;
name = QString::fromAscii("%1 | %2").arg(first->toString(), second->toString());
}