summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-23 09:49:40 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-11-23 09:49:40 (GMT)
commit772dffde89f33d7738207a32455b8b7c81e73551 (patch)
tree3be4a7fa6e5989cb7a60ac94fff520de38681ba6 /src/gui
parent76b66d6da548ce4a247727f14e09b1d301330db5 (diff)
parent33f9b5435edcf56555745e19896a14c790a33b1d (diff)
downloadQt-772dffde89f33d7738207a32455b8b7c81e73551.zip
Qt-772dffde89f33d7738207a32455b8b7c81e73551.tar.gz
Qt-772dffde89f33d7738207a32455b8b7c81e73551.tar.bz2
Merge branch 'fixes' of git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes2
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp26
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h4
2 files changed, 18 insertions, 12 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index fb67278..a6f5992 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);
@@ -2271,13 +2269,21 @@ QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin
layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]);
} else {
layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]);
+ }
- // If maxSize is less then "infinite", that means there are other anchors
- // grouped together with this one. We can't ignore its maximum value so we
- // set back the variable to NULL to prevent the continue condition from being
- // satisfied in the loop below.
- if (layoutEdge->maxSize < QWIDGETSIZE_MAX)
- layoutEdge = 0;
+ // If maxSize is less then "infinite", that means there are other anchors
+ // grouped together with this one. We can't ignore its maximum value so we
+ // set back the variable to NULL to prevent the continue condition from being
+ // satisfied in the loop below.
+ const qreal expectedMax = layoutCentralVertex[orient] ? QWIDGETSIZE_MAX / 2 : QWIDGETSIZE_MAX;
+ qreal actualMax;
+ if (layoutEdge->from == layoutFirstVertex[orient]) {
+ actualMax = layoutEdge->maxSize;
+ } else {
+ actualMax = -layoutEdge->minSize;
+ }
+ if (actualMax != expectedMax) {
+ layoutEdge = 0;
}
// For each variable, create constraints based on size hints
@@ -2700,7 +2706,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 2b365fb..8529e2e 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;