summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-07-07 14:24:49 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-07-07 15:04:14 (GMT)
commitfbc384f1bc1dd57e4af8e008b9db000b6ff82a37 (patch)
treeee7f8c03415f954e57d457711e9aa582778086c5 /src/gui/kernel
parent424e2e68f9a3f556ad2d06e2fbceac0d48c060be (diff)
downloadQt-fbc384f1bc1dd57e4af8e008b9db000b6ff82a37.zip
Qt-fbc384f1bc1dd57e4af8e008b9db000b6ff82a37.tar.gz
Qt-fbc384f1bc1dd57e4af8e008b9db000b6ff82a37.tar.bz2
On Mac OS X, translate the wrect to the coordinates on screen
In the following configuration, wrect was off-screen and the widget was not painted: -scroll area "A" -contains another scrollarea "B" with 2*WRECT_MAX < size < XCOORD_MAX -the widget contained in B has size > XCOORD_MAX -A is scrolled to the the bottom To fix the issue, wrect is moved to the area where the top level window is in the widget coordinate. Task-number: 144779 Reviewed-by: nrc
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget_mac.mm23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index b0531ec..48e174b 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3823,7 +3823,6 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
Qt coordinate system for parent
X coordinate system for parent (relative to parent's wrect).
*/
- QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
QRect wrect;
//xrect is the X geometry of my X widget. (starts out in parent's Qt coord sys, and ends up in parent's X coord sys)
QRect xrect = data.crect;
@@ -3845,6 +3844,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
parentWRect = QRect(tmpRect.origin.x, tmpRect.origin.y,
tmpRect.size.width, tmpRect.size.height);
} else {
+ const QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
parentWRect = wrectRange;
}
} else {
@@ -3900,15 +3900,24 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
}
}
- if (xrect.height() > XCOORD_MAX || xrect.width() > XCOORD_MAX) {
+ const QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
+ if (!validRange.contains(xrect)) {
// we are too big, and must clip
- xrect &=wrectRange;
+ QPoint screenOffset(0, 0); // offset of the part being on screen
+ const QWidget *parentWidget = q->parentWidget();
+ while (parentWidget) {
+ screenOffset -= parentWidget->data->crect.topLeft();
+ parentWidget = parentWidget->parentWidget();
+ }
+ QRect cropRect(screenOffset.x() - WRECT_MAX,
+ screenOffset.y() - WRECT_MAX,
+ 2*WRECT_MAX,
+ 2*WRECT_MAX);
+
+ xrect &=cropRect;
wrect = xrect;
- wrect.translate(-data.crect.topLeft());
- //parent's X coord system is equal to parent's Qt coord
- //sys, so we don't need to map xrect.
+ wrect.translate(-data.crect.topLeft()); // translate wrect in my Qt coordinates
}
-
}
// unmap if we are outside the valid window system coord system