summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-07-07 08:50:33 (GMT)
committeraxis <qt-info@nokia.com>2009-07-07 08:50:33 (GMT)
commit1e192edd72789241e7397dcbc5ee326b2aed5790 (patch)
tree430961aed08cdfa25717bde84c3f74a2f75673fe /src/gui/kernel
parent2aac0c8b71fffd7c0335c1429bd1f2405adaa5e7 (diff)
parent343e8b7e75c98a4fd1b692a230de8d1132988705 (diff)
downloadQt-1e192edd72789241e7397dcbc5ee326b2aed5790.zip
Qt-1e192edd72789241e7397dcbc5ee326b2aed5790.tar.gz
Qt-1e192edd72789241e7397dcbc5ee326b2aed5790.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: configure.exe src/network/access/qhttpnetworkconnection_p.h tests/auto/qstyle/qstyle.pro tests/auto/qstyle/tst_qstyle.cpp tools/configure/configureapp.cpp configure.exe will be recompiled in next commit. Took ours.
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qaction.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp7
-rw-r--r--src/gui/kernel/qapplication_mac.mm12
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm133
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h4
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm7
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm44
-rw-r--r--src/gui/kernel/qt_mac.cpp6
-rw-r--r--src/gui/kernel/qwidget_mac.mm36
9 files changed, 117 insertions, 136 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 4211be8..30667d7 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -250,7 +250,9 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
as described in the QMenuBar documentation.
\value ApplicationSpecificRole This action should be put in the application menu with an application specific role
\value AboutQtRole This action matches handles the "About Qt" menu item.
- \value AboutRole This action should be placed where the "About" menu item is in the application menu.
+ \value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of
+ the menu item will be set to "About <application name>". The application name is fetched from the
+ \c{Info.plist} file in the application's bundle (See \l{Deploying an Application on Mac OS X}).
\value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu.
\value QuitRole This action should be placed where the Quit menu item is in the application menu.
*/
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 658a047..01e0831 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3797,6 +3797,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
}
+ // ### Qt 5 These dynamic tool tips should be an OPT-IN feature. Some platforms
+ // like Mac OS X (probably others too), can optimize their views by not
+ // dispatching mouse move events. We have attributes to control hover,
+ // and mouse tracking, but as long as we are deciding to implement this
+ // feature without choice of opting-in or out, you ALWAYS have to have
+ // tracking enabled. Therefore, the other properties give a false sense of
+ // performance enhancement.
if (e->type() == QEvent::MouseMove && mouse->buttons() == 0) {
d->toolTipWidget = w;
d->toolTipPos = relpos;
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 5ded153..0d86c8e 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1294,8 +1294,13 @@ void QApplication::setOverrideCursor(const QCursor &cursor)
{
qApp->d_func()->cursor_list.prepend(cursor);
+#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+ [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) push];
+#else
if (qApp && qApp->activeWindow())
qt_mac_set_cursor(&qApp->d_func()->cursor_list.first(), QCursor::pos());
+#endif
}
void QApplication::restoreOverrideCursor()
@@ -1304,12 +1309,17 @@ void QApplication::restoreOverrideCursor()
return;
qApp->d_func()->cursor_list.removeFirst();
+#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+ [NSCursor pop];
+#else
if (qApp && qApp->activeWindow()) {
const QCursor def(Qt::ArrowCursor);
qt_mac_set_cursor(qApp->d_func()->cursor_list.isEmpty() ? &def : &qApp->d_func()->cursor_list.first(), QCursor::pos());
}
-}
#endif
+}
+#endif // QT_NO_CURSOR
QWidget *QApplication::topLevelAt(const QPoint &p)
{
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index ae3265b..e3ec30a 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -288,11 +288,18 @@ extern "C" {
{
if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
return NSDragOperationNone;
+ NSPoint windowPoint = [sender draggingLocation];
+ if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
+ // pass the drag enter event to the view underneath.
+ NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
+ if (candidateView && candidateView != self)
+ return [candidateView draggingEntered:sender];
+ }
+ dragEnterSequence = [sender draggingSequenceNumber];
[self addDropData:sender];
QMimeData *mimeData = dropData;
if (QDragManager::self()->source())
mimeData = QDragManager::self()->dragPrivate()->data;
- NSPoint windowPoint = [sender draggingLocation];
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
QPoint posDrag(localPoint.x, localPoint.y);
@@ -316,6 +323,9 @@ extern "C" {
[self removeDropData];
return NSDragOperationNone;
} else {
+ // save the mouse position, used by draggingExited handler.
+ DnDParams *dndParams = [QCocoaView currentMouseEvent];
+ dndParams->activeDragEnterPos = windowPoint;
// send a drag move event immediately after a drag enter event (as per documentation).
QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
qDMEvent.setDropAction(qDEEvent.dropAction());
@@ -336,11 +346,22 @@ extern "C" {
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
{
- // drag enter event was rejected, so ignore the move event.
+ NSPoint windowPoint = [sender draggingLocation];
+ if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
+ // pass the drag move event to the view underneath.
+ NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
+ if (candidateView && candidateView != self)
+ return [candidateView draggingUpdated:sender];
+ }
+ // in cases like QFocusFrame, the view under the mouse might
+ // not have received the drag enter. Generate a synthetic
+ // drag enter event for that view.
+ if (dragEnterSequence != [sender draggingSequenceNumber])
+ [self draggingEntered:sender];
+ // drag enter event was rejected, so ignore the move event.
if (dropData == 0)
return NSDragOperationNone;
// return last value, if we are still in the answerRect.
- NSPoint windowPoint = [sender draggingLocation];
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
NSDragOperation nsActions = [sender draggingSourceOperationMask];
@@ -379,21 +400,34 @@ extern "C" {
- (void)draggingExited:(id < NSDraggingInfo >)sender
{
- Q_UNUSED(sender)
- // drag enter event was rejected, so ignore the move event.
+ dragEnterSequence = -1;
+ if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
+ // try sending the leave event to the last view which accepted drag enter.
+ DnDParams *dndParams = [QCocoaView currentMouseEvent];
+ NSView *candidateView = [[[self window] contentView] hitTest:dndParams->activeDragEnterPos];
+ if (candidateView && candidateView != self)
+ return [candidateView draggingExited:sender];
+ }
+ // drag enter event was rejected, so ignore the move event.
if (dropData) {
QDragLeaveEvent de;
QApplication::sendEvent(qwidget, &de);
[self removeDropData];
}
-
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
+ NSPoint windowPoint = [sender draggingLocation];
+ dragEnterSequence = -1;
+ if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
+ // pass the drop event to the view underneath.
+ NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
+ if (candidateView && candidateView != self)
+ return [candidateView performDragOperation:sender];
+ }
[self addDropData:sender];
- NSPoint windowPoint = [sender draggingLocation];
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
QPoint posDrop(localPoint.x, localPoint.y);
@@ -554,6 +588,13 @@ extern "C" {
return !qwidget->testAttribute(Qt::WA_MacNoClickThrough);
}
+- (NSView *)hitTest:(NSPoint)aPoint
+{
+ if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents))
+ return nil; // You cannot hit a transparent for mouse event widget.
+ return [super hitTest:aPoint];
+}
+
- (void)updateTrackingAreas
{
QMacCocoaAutoReleasePool pool;
@@ -564,11 +605,15 @@ extern "C" {
[self removeTrackingArea:t];
}
}
+
+ // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should
+ // only be turned on if mouseTracking, hover is on or a tool tip is set.
+ // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to
+ // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of
+ // mouse moves delivered to it (Apple recommends keeping it OFF because there
+ // is a performance hit). So it goes.
NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp
- | NSTrackingInVisibleRect;
- if (qwidget->hasMouseTracking() || !qwidgetprivate->toolTip.isEmpty()
- || qwidget->testAttribute(Qt::WA_Hover))
- trackingOptions |= NSTrackingMouseMoved;
+ | NSTrackingInVisibleRect | NSTrackingMouseMoved;
NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0,
qwidget->width(),
qwidget->height())
@@ -633,62 +678,6 @@ extern "C" {
qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
-- (NSView *)viewUnderTransparentForMouseView:(NSView *)mouseView widget:(QWidget *)widgetToGetMouse
- withWindowPoint:(NSPoint)windowPoint
-{
- NSMutableArray *viewsToLookAt = [NSMutableArray arrayWithCapacity:5];
- [viewsToLookAt addObject:mouseView];
- QWidget *parentWidget = widgetToGetMouse->parentWidget();
- while (parentWidget) {
- [viewsToLookAt addObject:qt_mac_nativeview_for(parentWidget)];
- parentWidget = parentWidget->parentWidget();
- }
-
- // Now walk through the subviews of each view and determine which subview should
- // get the event. We look through all the subviews at a given level with
- // the assumption that the last item to be found the candidate has a higher z-order.
- // Unfortunately, fast enumeration doesn't go backwards in 10.5, so assume go fast
- // forward is quicker than the slow normal way backwards.
- NSView *candidateView = nil;
- for (NSView *lookView in viewsToLookAt) {
- NSPoint tmpPoint = [lookView convertPoint:windowPoint fromView:nil];
- for (NSView *view in [lookView subviews]) {
- if (view == mouseView || [view isHidden])
- continue;
- NSRect frameRect = [view frame];
- if (NSMouseInRect(tmpPoint, [view frame], [view isFlipped]))
- candidateView = view;
- }
- if (candidateView)
- break;
- }
-
-
- if (candidateView != nil) {
- // Now that we've got a candidate, we have to dig into it's tree and see where it is.
- NSView *lowerView = nil;
- NSView *viewForDescent = candidateView;
- while (viewForDescent) {
- NSPoint tmpPoint = [viewForDescent convertPoint:windowPoint fromView:nil];
- // Apply same rule as above wrt z-order.
- for (NSView *view in [viewForDescent subviews]) {
- if (![view isHidden] && NSMouseInRect(tmpPoint, [view frame], [view isFlipped]))
- lowerView = view;
- }
- if (!lowerView) // Low as we can be at this point.
- candidateView = viewForDescent;
-
- // Try to go deeper, will also exit out of the loop, if we found the point.
- viewForDescent = lowerView;
- lowerView = nil;
- }
- }
- // I am transparent, so I can't be a candidate.
- if (candidateView == mouseView)
- candidateView = nil;
- return candidateView;
-}
-
- (void)mouseDown:(NSEvent *)theEvent
{
qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton);
@@ -790,16 +779,6 @@ extern "C" {
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
QWidget *widgetToGetMouse = qwidget;
- if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // Simulate passing the event through since Cocoa doesn't do that for us.
- // Start by building a tree up.
- NSView *candidateView = [self viewUnderTransparentForMouseView:self
- widget:widgetToGetMouse
- withWindowPoint:windowPoint];
- if (candidateView != nil) {
- widgetToGetMouse = QWidget::find(WId(candidateView));
- }
- }
// Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets
// expect the delta to be a multiple of 120.
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index b4a60b6..24040ba 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -68,6 +68,7 @@ struct DnDParams
NSEvent *theEvent;
NSPoint localPoint;
NSDragOperation performedAction;
+ NSPoint activeDragEnterPos;
};
QT_END_NAMESPACE
@@ -85,6 +86,7 @@ Q_GUI_EXPORT
int composingLength;
bool sendKeyEvents;
QStringList *currentCustomTypes;
+ NSInteger dragEnterSequence;
}
- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
- (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
@@ -103,8 +105,6 @@ Q_GUI_EXPORT
- (QWidget *)qt_qwidget;
- (BOOL)qt_leftButtonIsRightButton;
- (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped;
-- (NSView *)viewUnderTransparentForMouseView:(NSView *)mouseView widget:(QWidget *)widgetToGetMouse
- withWindowPoint:(NSPoint)windowPoint;
+ (DnDParams*)currentMouseEvent;
@end
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/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 2dd4fdf..241ea44 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -851,50 +851,6 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil];
QPoint qlocalPoint(localPoint.x, localPoint.y);
- if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // Simulate passing the event through since Cocoa doesn't do that for us.
- // Start by building a tree up.
- NSView *candidateView = [theView viewUnderTransparentForMouseView:tmpView
- widget:widgetToGetMouse
- withWindowPoint:windowPoint];
- if (candidateView != nil) {
- // Fast-track our views, since dispatching trough the normal ways
- // would just end up going through here anyway.
- if ([candidateView isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
- return qt_mac_handleMouseEvent(candidateView, theEvent, eventType, button);
- } else {
- switch (eventType) {
- default:
- qWarning("not handled! %d", eventType);
- break;
- case QEvent::MouseMove:
- [candidateView mouseMoved:theEvent];
- break;
- case QEvent::MouseButtonPress:
- if (button == Qt::LeftButton)
- [candidateView mouseDown:theEvent];
- else if (button == Qt::RightButton)
- [candidateView rightMouseDown:theEvent];
- else
- [candidateView otherMouseDown:theEvent];
- break;
- case QEvent::MouseButtonRelease:
- if (button == Qt::LeftButton)
- [candidateView mouseUp:theEvent];
- else if (button == Qt::RightButton)
- [candidateView rightMouseUp:theEvent];
- else
- [candidateView otherMouseUp:theEvent];
- break;
- }
- return true; // We've done the dispatching, no need go further.
- }
- }
- // Nothing below me return false
- return false;
- }
-
-
EventRef carbonEvent = static_cast<EventRef>(const_cast<void *>([theEvent eventRef]));
if (qt_mac_sendMacEventToWidget(widgetToGetMouse, carbonEvent))
return true;
diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp
index 27df5d1..0c3b707 100644
--- a/src/gui/kernel/qt_mac.cpp
+++ b/src/gui/kernel/qt_mac.cpp
@@ -134,7 +134,7 @@ QColor qcolorForThemeTextColor(ThemeTextColor themeColor)
#ifdef Q_OS_MAC32
RGBColor c;
GetThemeTextColor(themeColor, 32, true, &c);
- QColor color = QColor(c.red / 265, c.green / 256, c.blue / 256);
+ QColor color = QColor(c.red / 256, c.green / 256, c.blue / 256);
return color;
#else
// There is no equivalent to GetThemeTextColor in 64-bit and it was rather bad that
@@ -156,13 +156,13 @@ QColor qcolorForThemeTextColor(ThemeTextColor themeColor)
case kThemeTextColorAlertInactive:
case kThemeTextColorDialogInactive:
case kThemeTextColorPlacardInactive:
- return QColor(67, 69, 69, 255);
+ return QColor(69, 69, 69, 255);
case kThemeTextColorPopupButtonInactive:
case kThemeTextColorPopupLabelInactive:
case kThemeTextColorPushButtonInactive:
case kThemeTextColorTabFrontInactive:
case kThemeTextColorBevelButtonInactive:
- return QColor(123, 127, 127, 255);
+ return QColor(127, 127, 127, 255);
default: {
QNativeImage nativeImage(16,16, QNativeImage::systemFormat());
CGRect cgrect = CGRectMake(0, 0, 16, 16);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 512abd1..e10a2f0 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1526,12 +1526,16 @@ void QWidgetPrivate::toggleDrawers(bool visible)
*****************************************************************************/
bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up)
{
+ // I'm not sure what "up" is
if(!w || !w->isWindow())
return false;
QTLWExtra *topData = w->d_func()->topData();
QWExtra *extraData = w->d_func()->extraData();
- topData->resizer += up;
+ // topData->resizer is only 4 bits, so subtracting -1 from zero causes bad stuff
+ // to happen, prevent that here (you really want the thing hidden).
+ if (up >= 0 || topData->resizer != 0)
+ topData->resizer += up;
OSWindowRef windowRef = qt_mac_window_for(OSViewRef(w->winId()));
{
#ifndef QT_MAC_USE_COCOA
@@ -1544,7 +1548,6 @@ bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up)
bool remove_grip = (topData->resizer || (w->windowFlags() & Qt::FramelessWindowHint)
|| (extraData->maxw && extraData->maxh &&
extraData->maxw == extraData->minw && extraData->maxh == extraData->minh));
-
#ifndef QT_MAC_USE_COCOA
WindowAttributes attr;
GetWindowAttributes(windowRef, &attr);
@@ -2173,11 +2176,10 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin
if ((popup || type == Qt::Tool || type == Qt::ToolTip) && !q->isModal()) {
[windowRef setHidesOnDeactivate:YES];
- [windowRef setHasShadow:YES];
} else {
[windowRef setHidesOnDeactivate:NO];
}
-
+ [windowRef setHasShadow:YES];
Q_UNUSED(parentWidget);
Q_UNUSED(dialog);
@@ -2731,10 +2733,15 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
createWinId();
if (q->isWindow()) {
#ifndef QT_MAC_USE_COCOA
- if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
- mwl->updateHIToolBarStatus();
+ // We do this down below for wasCreated, so avoid doing this twice
+ // (only for performance, it gets called a lot anyway).
+ if (!wasCreated) {
+ if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ mwl->updateHIToolBarStatus();
+ }
}
#else
+ // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon.
if (oldToolbar && !(f & Qt::FramelessWindowHint)) {
OSWindowRef newWindow = qt_mac_window_for(q);
[newWindow setToolbar:oldToolbar];
@@ -2749,6 +2756,16 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
if (wasCreated) {
transferChildren();
+#ifndef QT_MAC_USE_COCOA
+ // If we were a unified window, We just transfered our toolbars out of the unified toolbar.
+ // So redo the status one more time. It apparently is not an issue with Cocoa.
+ if (q->isWindow()) {
+ if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) {
+ mwl->updateHIToolBarStatus();
+ }
+ }
+#endif
+
if (topData &&
(!topData->caption.isEmpty() || !topData->filePath.isEmpty()))
setWindowTitle_helper(q->windowTitle());
@@ -4070,6 +4087,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()),
@@ -4077,7 +4096,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