From df7944e7d7dd8b2bbccbd639eff0ab09745d6cc3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 26 Aug 2013 19:29:33 +0200 Subject: Cocoa: Fix QFontDialog, QColorDialog auto-tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new Cocoa event dispatcher made apparent some deficiencies in the way the dialog helpers were being hidden. In particular, we would not stop a dialog helper's modal loop when closing the dialog, resulting in the auto-tests hanging. Also, since the QApplication event loop is runnig with [NSApp run] in the stack, the previous workarounds are no longer needed. Task-number: QTBUG-24321 Change-Id: Ifba713c286638d78a699c319a15683d09714f06f Reviewed-by: Richard Moe Gustavsen Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qcolordialog.cpp | 2 ++ src/widgets/dialogs/qfontdialog.cpp | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 5da41aa0a5..c9f03c5a97 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -2166,6 +2166,8 @@ void QColorDialog::keyPressEvent(QKeyEvent *e) } e->accept(); return; + } else if (d->nativeDialogInUse && d->platformColorDialogHelper()->event(e)) { + return; } QDialog::keyPressEvent(e); } diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index b989ea7c86..28afd91a09 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -983,14 +983,9 @@ void QFontDialog::setVisible(bool visible) Q_D(QFontDialog); if (d->canBeNativeDialog()) d->setNativeDialogVisible(visible); - if (d->nativeDialogInUse) { - // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below - // updates the state correctly, but skips showing the non-native version: - setAttribute(Qt::WA_DontShowOnScreen, true); - } else { - d->nativeDialogInUse = false; - setAttribute(Qt::WA_DontShowOnScreen, false); - } + // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below + // updates the state correctly, but skips showing the non-native version: + setAttribute(Qt::WA_DontShowOnScreen, d->nativeDialogInUse); QDialog::setVisible(visible); } -- cgit v1.2.3