summaryrefslogtreecommitdiff
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>2009-11-19 17:43:18 -0300
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-20 11:27:13 -0300
commit2bfa405a9798372624c410d3d13fa143985440b8 (patch)
tree9368c5990d9d725e781c972965801c0647e6075e /src/gui/graphicsview
parentea0f526ac3a7daef5d4ebff2373a01d4088e28c3 (diff)
downloadqt4-tools-2bfa405a9798372624c410d3d13fa143985440b8.tar.gz
QGAL: deal correctly with anchors in parallel with the layout
In the preferred size calculation, we should not add 'layout anchors' (either one or the two halves) into the objective function, since the layout doesn't impose or prefer any size at all. This already worked for cases when the layout anchor is one, but not when we have two halves. The mechanism was a 'skipInPreferred' flag that were not being set. The flag is pretty much redundant right now, since we can get this information from the 'isLayoutAnchor' flag. So, the flag was removed and a test was added for both a parallel case with the entire layout and other with half of the layout (which wasn't passing before). Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h4
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index fb6727815e..b324469319 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1272,7 +1272,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
addAnchor_helper(layout, Qt::AnchorLeft, layout,
Qt::AnchorRight, data);
data->maxSize = QWIDGETSIZE_MAX;
- data->skipInPreferred = 1;
// Save a reference to layout vertices
layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft);
@@ -1284,7 +1283,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges()
addAnchor_helper(layout, Qt::AnchorTop, layout,
Qt::AnchorBottom, data);
data->maxSize = QWIDGETSIZE_MAX;
- data->skipInPreferred = 1;
// Save a reference to layout vertices
layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop);
@@ -2700,7 +2698,9 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
//
for (int i = 0; i < variables.size(); ++i) {
AnchorData *ad = variables.at(i);
- if (ad->skipInPreferred)
+
+ // The layout original structure anchors are not relevant in preferred size calculation
+ if (ad->isLayoutAnchor)
continue;
QSimplexVariable *grower = new QSimplexVariable;
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 2b365fb14e..8529e2e673 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -124,8 +124,7 @@ struct AnchorData : public QSimplexVariable {
: QSimplexVariable(), from(0), to(0),
minSize(0), prefSize(0), maxSize(0),
sizeAtMinimum(0), sizeAtPreferred(0),
- sizeAtMaximum(0), item(0),
- graphicsAnchor(0), skipInPreferred(0),
+ sizeAtMaximum(0), item(0), graphicsAnchor(0),
type(Normal), isLayoutAnchor(false),
isCenterAnchor(false), orientation(0),
dependency(Independent) {}
@@ -169,7 +168,6 @@ struct AnchorData : public QSimplexVariable {
QGraphicsLayoutItem *item;
QGraphicsAnchor *graphicsAnchor;
- uint skipInPreferred : 1;
uint type : 2; // either Normal, Sequential or Parallel
uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor
uint isCenterAnchor : 1;