quick: minor code simplification
This commit is contained in:
parent
d71dc75b77
commit
27663fcb28
|
@ -25,6 +25,8 @@
|
|||
#include "framelesshelperquick_global.h"
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
#define REG_META_TYPE(Type) qRegisterMetaType<Type>(#Type)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickGlobal, "wangwenx190.framelesshelper.quick.global")
|
||||
|
@ -59,6 +61,15 @@ void initialize()
|
|||
inited = true;
|
||||
|
||||
FramelessHelper::Core::initialize();
|
||||
|
||||
// Registering meta types only causes troubles in Qt6.
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
REG_META_TYPE(QuickGlobal::SystemTheme);
|
||||
REG_META_TYPE(QuickGlobal::SystemButtonType);
|
||||
REG_META_TYPE(QuickGlobal::ButtonState);
|
||||
REG_META_TYPE(QuickGlobal::BlurMode);
|
||||
REG_META_TYPE(QuickGlobal::WindowEdge);
|
||||
#endif
|
||||
}
|
||||
|
||||
void uninitialize()
|
||||
|
|
|
@ -84,20 +84,16 @@ void FramelessHelper::Quick::registerTypes(QQmlEngine *engine)
|
|||
// @uri org.wangwenx190.FramelessHelper
|
||||
qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, "FramelessHelperConstants",
|
||||
FRAMELESSHELPER_STRING_LITERAL("The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums."));
|
||||
|
||||
qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND("FramelessUtils"),
|
||||
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
return new FramelessQuickUtils;
|
||||
});
|
||||
|
||||
qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5, 16, 0))
|
||||
qRegisterMetaType<QuickGlobal::SystemTheme>("QuickGlobal::SystemTheme");
|
||||
qRegisterMetaType<QuickGlobal::SystemButtonType>("QuickGlobal::SystemButtonType");
|
||||
qRegisterMetaType<QuickGlobal::ButtonState>("QuickGlobal::ButtonState");
|
||||
qRegisterMetaType<QuickGlobal::BlurMode>("QuickGlobal::BlurMode");
|
||||
qRegisterMetaType<QuickGlobal::WindowEdge>("QuickGlobal::WindowEdge");
|
||||
#endif
|
||||
|
||||
qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND("FramelessHelper"));
|
||||
qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND("MicaMaterial"));
|
||||
qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND("ImageItem"));
|
||||
|
|
Loading…
Reference in New Issue