diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-11-04 14:56:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-05 12:20:39 +0100 |
commit | e17ae3b8b716b00c7cb6156347101f2e789dbd58 (patch) | |
tree | 931fcffe5321133bc4d5e6429a8c3c8beb809f71 /src/imports | |
parent | 2a1fc76f4ed1680e78b740c47fa736768aed82e9 (diff) |
Replace Message attached property with gadget types
This is a more efficient way to expose the StandardButton and
StandardIcon enums.
Change-Id: I9d0becf54be2a883d55c9eaeaf10b83b23e59f3c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/dialogs/dialogs.pro | 2 | ||||
-rw-r--r-- | src/imports/dialogs/plugin.cpp | 7 | ||||
-rw-r--r-- | src/imports/dialogs/qquickdialogassets_p.h (renamed from src/imports/dialogs/qquickmessageattached_p.h) | 24 |
3 files changed, 16 insertions, 17 deletions
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index e6ca7a2147..1abad55883 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -25,7 +25,7 @@ HEADERS += \ qquickabstractmessagedialog_p.h \ qquickplatformmessagedialog_p.h \ qquickmessagedialog_p.h \ - qquickmessageattached_p.h \ + qquickdialogassets_p.h \ qquickabstractfiledialog_p.h \ qquickplatformfiledialog_p.h \ qquickfiledialog_p.h \ diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index 1c852abae9..c85d270c6e 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -43,7 +43,7 @@ #include <QtQml/qqmlextensionplugin.h> #include "qquickmessagedialog_p.h" #include "qquickabstractmessagedialog_p.h" -#include "qquickmessageattached_p.h" +#include "qquickdialogassets_p.h" #include "qquickplatformmessagedialog_p.h" #include "qquickfiledialog_p.h" #include "qquickabstractfiledialog_p.h" @@ -122,7 +122,10 @@ public: // Otherwise fall back to a pure-QML implementation. // MessageDialog - qmlRegisterUncreatableType<QQuickMessageAttached>(uri, 1, 1, "Message", QQuickMessageAttached::tr("Message can only be used via the attached property.")); + qmlRegisterUncreatableType<QQuickStandardButton>(uri, 1, 1, "StandardButton", + QLatin1String("Do not create objects of type StandardButton")); + qmlRegisterUncreatableType<QQuickStandardIcon>(uri, 1, 1, "StandardIcon", + QLatin1String("Do not create objects of type StandardIcon")); #ifndef PURE_QML_ONLY if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::MessageDialog)) qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog"); diff --git a/src/imports/dialogs/qquickmessageattached_p.h b/src/imports/dialogs/qquickdialogassets_p.h index c1cb94ae36..406b68a66d 100644 --- a/src/imports/dialogs/qquickmessageattached_p.h +++ b/src/imports/dialogs/qquickdialogassets_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QQUICKMESSAGEATTACHED_H -#define QQUICKMESSAGEATTACHED_H +#ifndef QQUICKDIALOGASSETS_P_H +#define QQUICKDIALOGASSETS_P_H #include <private/qtquickglobal_p.h> #include <QtGui/qpa/qplatformdialoghelper.h> @@ -48,22 +48,18 @@ QT_BEGIN_NAMESPACE -class Q_DECL_EXPORT QQuickMessageAttached : public QObject +class QQuickStandardButton { - Q_OBJECT - Q_ENUMS(QQuickAbstractMessageDialog::Icon) + Q_GADGET Q_ENUMS(QQuickAbstractMessageDialog::StandardButton) +}; -public: - static QQuickMessageAttached *qmlAttachedProperties(QObject *obj) { - return new QQuickMessageAttached(obj); } - - QQuickMessageAttached(QObject *parent = 0) : QObject(parent) { } +class QQuickStandardIcon +{ + Q_GADGET + Q_ENUMS(QQuickAbstractMessageDialog::Icon) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickMessageAttached) -QML_DECLARE_TYPEINFO(QQuickMessageAttached, QML_HAS_ATTACHED_PROPERTIES) - -#endif // QQUICKMESSAGEATTACHED_H +#endif // QQUICKDIALOGASSETS_P_H |