diff --git a/wallpapers/image/plugin/imagebackend.h b/wallpapers/image/plugin/imagebackend.h index 1fc97bcd6..ee9fa02cb 100644 --- a/wallpapers/image/plugin/imagebackend.h +++ b/wallpapers/image/plugin/imagebackend.h @@ -24,7 +24,7 @@ class ImageProxyModel; class SlideModel; class SlideFilterModel; -class ImageBackend : public QObject, public QQmlParserStatus, public SortingMode +class ImageBackend : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) diff --git a/wallpapers/image/plugin/imageplugin.cpp b/wallpapers/image/plugin/imageplugin.cpp index de773f443..7e88a6ba6 100644 --- a/wallpapers/image/plugin/imageplugin.cpp +++ b/wallpapers/image/plugin/imageplugin.cpp @@ -39,6 +39,6 @@ void ImagePlugin::registerTypes(const char *uri) qmlRegisterAnonymousType("QAbstractItemModel", 1); - qmlRegisterUncreatableType(uri, 2, 0, "BackgroundType", QStringLiteral("error: only enums")); - qmlRegisterUncreatableType(uri, 2, 0, "SortingMode", QStringLiteral("error: only enums")); + qmlRegisterUncreatableMetaObject(BackgroundType::staticMetaObject, uri, 2, 0, "BackgroundType", QStringLiteral("error: only enums")); + qmlRegisterUncreatableMetaObject(SortingMode::staticMetaObject, uri, 2, 0, "SortingMode", QStringLiteral("error: only enums")); } diff --git a/wallpapers/image/plugin/sortingmode.h b/wallpapers/image/plugin/sortingmode.h index 17131d4e1..4193dd9cf 100644 --- a/wallpapers/image/plugin/sortingmode.h +++ b/wallpapers/image/plugin/sortingmode.h @@ -7,19 +7,18 @@ #ifndef SORTINGMODE_H #define SORTINGMODE_H -class SortingMode +namespace SortingMode { - Q_GADGET +Q_NAMESPACE -public: - enum Mode { - Random, - Alphabetical, - AlphabeticalReversed, - Modified, - ModifiedReversed, - }; - Q_ENUM(Mode) +enum Mode { + Random, + Alphabetical, + AlphabeticalReversed, + Modified, + ModifiedReversed, }; +Q_ENUM_NS(Mode) +} #endif diff --git a/wallpapers/image/plugin/utils/backgroundtype.h b/wallpapers/image/plugin/utils/backgroundtype.h index d198d4d98..124542d2d 100644 --- a/wallpapers/image/plugin/utils/backgroundtype.h +++ b/wallpapers/image/plugin/utils/backgroundtype.h @@ -6,15 +6,14 @@ #pragma once -class BackgroundType +namespace BackgroundType { - Q_GADGET +Q_NAMESPACE -public: - enum class Type { - Unknown, - Image, - AnimatedImage, /**< AnimatedImage doesn't support \QQuickImageProvider , @see https://bugreports.qt.io/browse/QTBUG-30524 */ - }; - Q_ENUM(Type) +enum class Type { + Unknown, + Image, + AnimatedImage, /**< AnimatedImage doesn't support \QQuickImageProvider , @see https://bugreports.qt.io/browse/QTBUG-30524 */ }; +Q_ENUM_NS(Type) +}