Change wallpaper enums to be in namespaces rather than in gadgets

Qt 6 no longer allows exporting gadgets with an uppercase name. Namespaces
work just as well here, but we unfortunately have this problem also in
other places where the solution is less straightforward.
wilder-5.26
Volker Krause 4 years ago
parent 170564cde7
commit 516d2b9733
  1. 2
      wallpapers/image/plugin/imagebackend.h
  2. 4
      wallpapers/image/plugin/imageplugin.cpp
  3. 21
      wallpapers/image/plugin/sortingmode.h
  4. 17
      wallpapers/image/plugin/utils/backgroundtype.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)

@ -39,6 +39,6 @@ void ImagePlugin::registerTypes(const char *uri)
qmlRegisterAnonymousType<QAbstractItemModel>("QAbstractItemModel", 1);
qmlRegisterUncreatableType<BackgroundType>(uri, 2, 0, "BackgroundType", QStringLiteral("error: only enums"));
qmlRegisterUncreatableType<SortingMode>(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"));
}

@ -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

@ -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)
}

Loading…
Cancel
Save