Cocoa: QPrintDialog does not show/closes down immediatly
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>
Thu, 25 Oct 2012 13:28:07 +0000 (15:28 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 14 Nov 2012 07:37:50 +0000 (08:37 +0100)
commit26db7de13d5885067844532b5a5814181a0ddf16
tree859a521ef2c6987e0ea3934035441c1cba98ad5b
parentac9b853242f652dac53aeec561f24ff46d2eae3e
Cocoa: QPrintDialog does not show/closes down immediatly

This happends if an event loop recursion ends before
the native print dialog gets executed (in the same scope).

The reason is that the event dispatcher gets interrupted as the
first recursion ends. And (because of the big difference between
how AppKit implements modal windows compared to Qt) this sets a flag
in the dispatcher that gets handled on the next callback to
QCocoaEventDispatcher::processPostedEvents. This will tell
the dispatcher to break out of the current modal session.
But since it cannot detect that an alien (native) session is now
running, it closes down that session by accident instead.

While code can be written in the event dispatcher to detect this
problem, it ends up more clean to just work around the problem
from the native dialogs instead. This to avoid making the
dispatcher more complex than it already is. Native dialogs is
a bit messy already, and the work-arounds needed should be
isolated inside those components, and not inside the dispatcher.

Change-Id: Ibfde9db4c98401562e7628da1db18d6bed619245
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
src/printsupport/dialogs/qprintdialog_mac.mm