summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-09-18 09:40:47 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-09-18 10:35:48 (GMT)
commitd01cc3cfe24394159b6a0d724ab6d8d59912365a (patch)
treecc820a9906dd0806a50624e9e0f469d25e773eea /src
parent9c62a7d9f0f8a02ad6c445b82a50eccb3c51a378 (diff)
downloadQt-d01cc3cfe24394159b6a0d724ab6d8d59912365a.zip
Qt-d01cc3cfe24394159b6a0d724ab6d8d59912365a.tar.gz
Qt-d01cc3cfe24394159b6a0d724ab6d8d59912365a.tar.bz2
Don't loose precision by converting the sizes (qreals) to ints.
Reviewed-by: leo
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 4eeff82..7041d58 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -856,21 +856,17 @@ void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item)
items.append(item);
- // Horizontal
- int minimumSize = item->minimumWidth();
- int preferredSize = item->preferredWidth();
- int maximumSize = item->maximumWidth();
+ QSizeF minSize = item->effectiveSizeHint(Qt::MinimumSize);
+ QSizeF prefSize = item->effectiveSizeHint(Qt::PreferredSize);
+ QSizeF maxSize = item->effectiveSizeHint(Qt::MaximumSize);
- AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize);
+ // Horizontal
+ AnchorData *data = new AnchorData(minSize.width(), prefSize.width(), maxSize.width());
addAnchor_helper(item, Qt::AnchorLeft, item,
Qt::AnchorRight, data);
// Vertical
- minimumSize = item->minimumHeight();
- preferredSize = item->preferredHeight();
- maximumSize = item->maximumHeight();
-
- data = new AnchorData(minimumSize, preferredSize, maximumSize);
+ data = new AnchorData(minSize.height(), prefSize.height(), maxSize.height());
addAnchor_helper(item, Qt::AnchorTop, item,
Qt::AnchorBottom, data);
}
@@ -927,9 +923,9 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors(
// Create new anchors
AnchorData *oldData = graph[orientation].edgeData(first, last);
- int minimumSize = oldData->minSize / 2;
- int preferredSize = oldData->prefSize / 2;
- int maximumSize = oldData->maxSize / 2;
+ qreal minimumSize = oldData->minSize / 2;
+ qreal preferredSize = oldData->prefSize / 2;
+ qreal maximumSize = oldData->maxSize / 2;
QSimplexConstraint *c = new QSimplexConstraint;
AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize);
@@ -1001,9 +997,9 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors(
// Create the new anchor that should substitute the left-center-right anchors.
AnchorData *oldData = g.edgeData(first, center);
- int minimumSize = oldData->minSize * 2;
- int preferredSize = oldData->prefSize * 2;
- int maximumSize = oldData->maxSize * 2;
+ qreal minimumSize = oldData->minSize * 2;
+ qreal preferredSize = oldData->prefSize * 2;
+ qreal maximumSize = oldData->maxSize * 2;
AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize);
addAnchor_helper(item, firstEdge, item, lastEdge, data);