summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout_p.h
diff options
context:
space:
mode:
authorEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-10-29 20:14:09 (GMT)
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-04 23:28:09 (GMT)
commit52d737eb6f4b79cd0c7fc7ee1d041fb19d286a27 (patch)
treef40577f5884947aed6ce480e15bbdf106adb0f89 /src/gui/graphicsview/qgraphicsanchorlayout_p.h
parent56c04b7f546babf5bbe64a6d0175f635cb2fd204 (diff)
downloadQt-52d737eb6f4b79cd0c7fc7ee1d041fb19d286a27.zip
Qt-52d737eb6f4b79cd0c7fc7ee1d041fb19d286a27.tar.gz
Qt-52d737eb6f4b79cd0c7fc7ee1d041fb19d286a27.tar.bz2
QGAL: Do not create sizeHint constraints for dependent anchors
Some anchors have their sizes linked directly to the size of others. That is the case for instance with center anchors where one half must have exactly the same size as the other. To make that more clear, adding "dependency" info to AnchorData and setting it accordingly. This is future proof in the sense that if someday we are allowed to anchor to other items in terms of percentages, like, anchor to 70% of an items' width, we would also need this notion. Knowing that, we no longer need to create size hint constraints for the slave anchors, only for the master ones. The size of slave anchors is enforced by the dependency constraint (sizeSlave = X * sizeMaster). Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-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.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 7d7bdb6..2f0237c 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -150,6 +150,12 @@ struct AnchorData : public QSimplexVariable {
Parallel
};
+ enum Dependency {
+ Independent = 0,
+ Master,
+ Slave
+ };
+
AnchorData()
: QSimplexVariable(), item(0), from(0), to(0),
minSize(0), prefSize(0), expSize(0), maxSize(0),
@@ -157,7 +163,8 @@ struct AnchorData : public QSimplexVariable {
sizeAtExpanding(0), sizeAtMaximum(0),
graphicsAnchor(0), skipInPreferred(0),
type(Normal), hasSize(true), isLayoutAnchor(false),
- isCenterAnchor(false), orientation(0) {}
+ isCenterAnchor(false), orientation(0),
+ dependency(Independent) {}
virtual void updateChildrenSizes() {}
virtual bool refreshSizeHints(const QLayoutStyleInfo *styleInfo);
@@ -212,6 +219,7 @@ struct AnchorData : public QSimplexVariable {
uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor
uint isCenterAnchor : 1;
uint orientation : 1;
+ uint dependency : 2; // either Independent, Master or Slave
};
#ifdef QT_DEBUG