summaryrefslogtreecommitdiff
path: root/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
diff options
context:
space:
mode:
authorEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-19 17:07:02 -0300
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-11-27 16:19:07 -0300
commita801b57a403548cccd081d8a0ae1f174d2201f9a (patch)
tree78fa49986bcfefa58b017047faef59d0eecccc80 /src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
parent7a930ec85684a38212165aff29ed84d95bd43d32 (diff)
downloadqt4-tools-a801b57a403548cccd081d8a0ae1f174d2201f9a.tar.gz
QGAL: Rename internalSizeHints to applySizePolicy
Former name did not reflect actual work done by the function. 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.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index b698c02d85..d9f4e325e5 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -138,10 +138,10 @@ qreal QGraphicsAnchorPrivate::spacing() const
}
-static void internalSizeHints(QSizePolicy::Policy policy,
- qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint,
- qreal *minSize, qreal *prefSize,
- qreal *maxSize)
+static void applySizePolicy(QSizePolicy::Policy policy,
+ qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint,
+ qreal *minSize, qreal *prefSize,
+ qreal *maxSize)
{
// minSize, prefSize and maxSize are initialized
// with item's preferred Size: this is QSizePolicy::Fixed.
@@ -224,14 +224,18 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
// It is a user-created anchor, fetch size information from the associated QGraphicsAnchor
Q_ASSERT(graphicsAnchor);
QGraphicsAnchorPrivate *anchorPrivate = graphicsAnchor->d_func();
+
+ // Policy, min and max sizes are straightforward
policy = anchorPrivate->sizePolicy;
minSizeHint = 0;
+ maxSizeHint = QWIDGETSIZE_MAX;
+
+ // Preferred Size
if (anchorPrivate->hasSize) {
- // One can only configure the preferred size of a normal anchor. Their minimum and
- // maximum "size hints" are always 0 and QWIDGETSIZE_MAX, correspondingly. However,
- // their effective size hints might be narrowed down due to their size policies.
+ // Anchor has user-defined size
prefSizeHint = anchorPrivate->preferredSize;
} else {
+ // Fetch size information from style
const Qt::Orientation orient = Qt::Orientation(QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge) + 1);
qreal s = styleInfo->defaultSpacing(orient);
if (s < 0) {
@@ -247,10 +251,11 @@ void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
}
prefSizeHint = s;
}
- maxSizeHint = QWIDGETSIZE_MAX;
}
- internalSizeHints(policy, minSizeHint, prefSizeHint, maxSizeHint,
- &minSize, &prefSize, &maxSize);
+
+ // Fill minSize, prefSize and maxSize based on policy and sizeHints
+ applySizePolicy(policy, minSizeHint, prefSizeHint, maxSizeHint,
+ &minSize, &prefSize, &maxSize);
// Set the anchor effective sizes to preferred.
//