diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-06-30 08:14:00 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-06-30 08:31:21 (GMT) |
commit | 8e08d5b8fcceee9a3d156b1e18363f48e19ec79b (patch) | |
tree | 171ef49079398114cfcac68af5cf3fe52e5912cf /src/gui | |
parent | 814e9b546b29e5a21d6d8d3823ad53ac58f12231 (diff) | |
download | Qt-8e08d5b8fcceee9a3d156b1e18363f48e19ec79b.zip Qt-8e08d5b8fcceee9a3d156b1e18363f48e19ec79b.tar.gz Qt-8e08d5b8fcceee9a3d156b1e18363f48e19ec79b.tar.bz2 |
QWidget::adjustSize() sends a spontaneous event - Mac OS X Cocoa
The windowDidResize notification now differentiates an internally
triggered resize from a user triggered resize.
Task-number: 256269
Reviewed-by: Norwegian Rock Cat
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qcocoawindowdelegate_mac.mm | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 9b49efc..3905e21 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -132,7 +132,12 @@ static void cleanupCocoaWindowDelegate() qwidget->setAttribute(Qt::WA_PendingResizeEvent, true); } else { QResizeEvent qre(newSize, oldSize); - qt_sendSpontaneousEvent(qwidget, &qre); + if (qwidget->testAttribute(Qt::WA_PendingResizeEvent)) { + qwidget->setAttribute(Qt::WA_PendingResizeEvent, false); + QApplication::sendEvent(qwidget, &qre); + } else { + qt_sendSpontaneousEvent(qwidget, &qre); + } } } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b9183de..1c71fbd 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4069,6 +4069,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) setGeometry_sys_helper(x, y, w, h, isMove); } #else + QSize olds = q->size(); + const bool isResize = (olds != QSize(w, h)); NSWindow *window = qt_mac_window_for(q); const QRect &fStrut = frameStrut(); const QRect frameRect(QPoint(x - fStrut.left(), y - fStrut.top()), @@ -4076,7 +4078,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) fStrut.top() + fStrut.bottom() + h)); NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1), frameRect.width(), frameRect.height()); - + // The setFrame call will trigger a 'windowDidResize' notification for the corresponding + // NSWindow. The pending flag is set, so that the resize event can be send as non-spontaneous. + if (isResize) + q->setAttribute(Qt::WA_PendingResizeEvent); QPoint currTopLeft = data.crect.topLeft(); if (currTopLeft.x() == x && currTopLeft.y() == y && cocoaFrameRect.size.width != 0 |