summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs/qdialog.cpp')
-rw-r--r--src/widgets/dialogs/qdialog.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index af11fc971d..f462a362ca 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,12 +34,14 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qdialog.h"
-
+#include "qcolordialog.h"
+#include "qfontdialog.h"
+#include "qfiledialog.h"
#include "qevent.h"
#include "qdesktopwidget.h"
@@ -59,22 +60,36 @@
QT_BEGIN_NAMESPACE
+static inline int themeDialogType(const QDialog *dialog)
+{
+ if (qobject_cast<const QFileDialog *>(dialog))
+ return QPlatformTheme::FileDialog;
+ if (qobject_cast<const QColorDialog *>(dialog))
+ return QPlatformTheme::ColorDialog;
+ if (qobject_cast<const QFontDialog *>(dialog))
+ return QPlatformTheme::FontDialog;
+ return -1;
+}
+
QPlatformDialogHelper *QDialogPrivate::platformHelper() const
{
// Delayed creation of the platform, ensuring that
// that qobject_cast<> on the dialog works in the plugin.
if (!m_platformHelperCreated) {
- QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
m_platformHelperCreated = true;
+ QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
QDialog *dialog = ncThis->q_func();
- m_platformHelper = QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(dialog);
- if (m_platformHelper) {
- QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
- QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
- QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
- dialog, SLOT(_q_platformRunNativeAppModalPanel()));
- ncThis->initHelper(m_platformHelper);
+ const int type = themeDialogType(dialog);
+ if (type >= 0) {
+ m_platformHelper = QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(static_cast<QPlatformTheme::DialogType>(type));
+ if (m_platformHelper) {
+ QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
+ QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
+ QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
+ dialog, SLOT(_q_platformRunNativeAppModalPanel()));
+ ncThis->initHelper(m_platformHelper);
+ }
}
}
return m_platformHelper;
@@ -733,7 +748,7 @@ void QDialog::setVisible(bool visible)
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::DialogStart);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this, 0));
#endif
} else {
@@ -742,7 +757,7 @@ void QDialog::setVisible(bool visible)
#ifndef QT_NO_ACCESSIBILITY
if (isVisible())
- QAccessible::updateAccessibility(this, 0, QAccessible::DialogEnd);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this, 0));
#endif
// Reimplemented to exit a modal event loop when the dialog is hidden.