diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-11-10 13:07:01 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-11 10:58:10 +0100 |
commit | af914694d81317b4a7bf0804d9d34a1f3bf2cf48 (patch) | |
tree | 039dc97541bc51cdeddf21b5f8949d5e998b18de /src/widgets/kernel/qplatformdialoghelper_qpa.h | |
parent | 9a8a70d8e42f7e8fee8398affa5680adb2ba24d6 (diff) |
QPlatformDialogHelper: Split class hierarchy, decouple from Dialog
- Introduce hierarchy of QPlatformDialogHelper-derived classes
for font, color and file dialogs.
- Start reducing dependencies on QDialog:
* Remove QDialog-specifics from interface, introduce enumeration
for DialogCode
* Make the helpers Q_OBJECTS to be able to add the signals
passed on to the QDialogs
* Remove QDialogPrivate pointer
- Split setVisible_sys() in show_sys() (factory method for native
dialogs) and hide_sys(). Pass parent window to show_sys(),
removing the necessity to query the QDialog for it
- Introduce a styleHint() similar to QGuiApplication's for
platform-specific
- Fix compile in cocoa/windows, reduce depency on QDialog
(-private) classes.
Change-Id: Ic1cb715e1edf767f2cb18b9780341d189339ef1d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qplatformdialoghelper_qpa.h')
-rw-r--r-- | src/widgets/kernel/qplatformdialoghelper_qpa.h | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/src/widgets/kernel/qplatformdialoghelper_qpa.h b/src/widgets/kernel/qplatformdialoghelper_qpa.h index 2a3fbaa87e..970de611bc 100644 --- a/src/widgets/kernel/qplatformdialoghelper_qpa.h +++ b/src/widgets/kernel/qplatformdialoghelper_qpa.h @@ -43,7 +43,7 @@ #define QPLATFORMDIALOGHELPER_H #include <qglobal.h> -#include <qdialog.h> +#include <qobject.h> QT_BEGIN_HEADER @@ -52,23 +52,66 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QString; -class QObjectPrivate; +class QColor; +class QFont; +class QWindow; +class QVariant; -class Q_WIDGETS_EXPORT QPlatformDialogHelper +class Q_WIDGETS_EXPORT QPlatformDialogHelper : public QObject { + Q_OBJECT public: + enum StyleHint { + SnapToDefaultButton + }; + enum DialogCode { Rejected, Accepted }; + QPlatformDialogHelper(); virtual ~QPlatformDialogHelper(); + virtual QVariant styleHint(StyleHint hint) const; + virtual void platformNativeDialogModalHelp() = 0; virtual void _q_platformRunNativeAppModalPanel() = 0; - virtual bool defaultNameFilterDisables() const = 0; - virtual void deleteNativeDialog_sys() = 0; - virtual bool setVisible_sys(bool visible) = 0; - virtual QDialog::DialogCode dialogResultCode_sys() = 0; + virtual bool show_sys(QWindow *parent) = 0; + virtual void hide_sys() = 0; + + virtual DialogCode dialogResultCode_sys() = 0; + + static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint); +}; + +class Q_WIDGETS_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper +{ + Q_OBJECT +public: + virtual void setCurrentColor_sys(const QColor &) = 0; + virtual QColor currentColor_sys() const = 0; +Q_SIGNALS: + void currentColorChanged(const QColor &color); + void colorSelected(const QColor &color); +}; + +class Q_WIDGETS_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper +{ + Q_OBJECT +public: + virtual void setCurrentFont_sys(const QFont &) = 0; + virtual QFont currentFont_sys() const = 0; + +Q_SIGNALS: + void currentFontChanged(const QFont &font); + void fontSelected(const QFont &font); +}; + +class Q_WIDGETS_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper +{ + Q_OBJECT +public: + virtual bool defaultNameFilterDisables() const = 0; virtual void setDirectory_sys(const QString &directory) = 0; virtual QString directory_sys() const = 0; virtual void selectFile_sys(const QString &filename) = 0; @@ -78,7 +121,12 @@ public: virtual void selectNameFilter_sys(const QString &filter) = 0; virtual QString selectedNameFilter_sys() const = 0; - QObjectPrivate *d_ptr; +Q_SIGNALS: + void fileSelected(const QString &file); + void filesSelected(const QStringList &files); + void currentChanged(const QString &path); + void directoryEntered(const QString &directory); + void filterSelected(const QString &filter); }; QT_END_NAMESPACE |