This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 2525#include " framelesshelperquick_global.h"
2626#include < QtCore/qloggingcategory.h>
2727
28+ #define REG_META_TYPE (Type ) qRegisterMetaType<Type>(#Type)
29+
2830FRAMELESSHELPER_BEGIN_NAMESPACE
2931
3032[[maybe_unused]] static Q_LOGGING_CATEGORY (lcQuickGlobal, " wangwenx190.framelesshelper.quick.global" )
@@ -59,6 +61,15 @@ void initialize()
5961 inited = true ;
6062
6163 FramelessHelper::Core::initialize ();
64+
65+ // Registering meta types only causes troubles in Qt6.
66+ #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
67+ REG_META_TYPE (QuickGlobal::SystemTheme);
68+ REG_META_TYPE (QuickGlobal::SystemButtonType);
69+ REG_META_TYPE (QuickGlobal::ButtonState);
70+ REG_META_TYPE (QuickGlobal::BlurMode);
71+ REG_META_TYPE (QuickGlobal::WindowEdge);
72+ #endif
6273}
6374
6475void uninitialize ()
Original file line number Diff line number Diff line change @@ -84,20 +84,16 @@ void FramelessHelper::Quick::registerTypes(QQmlEngine *engine)
8484 // @uri org.wangwenx190.FramelessHelper
8585 qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, " FramelessHelperConstants" ,
8686 FRAMELESSHELPER_STRING_LITERAL (" The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums." ));
87+
8788 qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND (" FramelessUtils" ),
8889 [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
8990 Q_UNUSED (engine);
9091 Q_UNUSED (scriptEngine);
9192 return new FramelessQuickUtils;
9293 });
94+
9395 qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
94- #if (QT_VERSION <= QT_VERSION_CHECK(5, 16, 0))
95- qRegisterMetaType<QuickGlobal::SystemTheme>(" QuickGlobal::SystemTheme" );
96- qRegisterMetaType<QuickGlobal::SystemButtonType>(" QuickGlobal::SystemButtonType" );
97- qRegisterMetaType<QuickGlobal::ButtonState>(" QuickGlobal::ButtonState" );
98- qRegisterMetaType<QuickGlobal::BlurMode>(" QuickGlobal::BlurMode" );
99- qRegisterMetaType<QuickGlobal::WindowEdge>(" QuickGlobal::WindowEdge" );
100- #endif
96+
10197 qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND (" FramelessHelper" ));
10298 qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND (" MicaMaterial" ));
10399 qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND (" ImageItem" ));
You can’t perform that action at this time.
0 commit comments