注册设置模块的元对象
This commit is contained in:
parent
f3053a7076
commit
f25ad51865
|
@ -85,7 +85,7 @@ private:
|
|||
class CommonsModule
|
||||
{
|
||||
public:
|
||||
static void defineCommonsMod(const char *uri, int versionMajor, int versionMinor) {
|
||||
static void defineModule(const char *uri, int versionMajor, int versionMinor) {
|
||||
qRegisterMetaType<UkuiMenu::SortType::Type>("SortType::Type");
|
||||
qRegisterMetaType<UkuiMenu::DataType::Type>("DataType::Type");
|
||||
qRegisterMetaType<UkuiMenu::DataEntity>("DataEntity");
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <QVariant>
|
||||
#include <QDebug>
|
||||
#include <QtQml>
|
||||
|
||||
#define UKUI_MENU_SCHEMA "org.ukui.menu.settings"
|
||||
#define CONTROL_CENTER_SETTING "org.ukui.control-center.personalise"
|
||||
|
@ -31,6 +32,12 @@
|
|||
|
||||
namespace UkuiMenu {
|
||||
|
||||
void SettingModule::defineModule(const char *uri, int versionMajor, int versionMinor)
|
||||
{
|
||||
qRegisterMetaType<GlobalSetting::Key>("GlobalSetting::Key");
|
||||
qmlRegisterUncreatableType<GlobalSetting>(uri, versionMajor, versionMinor, "GlobalSetting", "Use enums only.");
|
||||
}
|
||||
|
||||
GlobalSetting *GlobalSetting::instance()
|
||||
{
|
||||
static GlobalSetting setting(nullptr);
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
|
||||
namespace UkuiMenu {
|
||||
|
||||
class SettingModule
|
||||
{
|
||||
public:
|
||||
static void defineModule(const char *uri, int versionMajor, int versionMinor);
|
||||
};
|
||||
|
||||
class GlobalSetting : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -45,7 +45,9 @@ void UkuiMenuApplication::registerQmlTypes()
|
|||
{
|
||||
const char *uri = "org.ukui.menu.core";
|
||||
int versionMajor = 1, versionMinor = 0;
|
||||
CommonsModule::defineCommonsMod(uri, versionMajor, versionMinor);
|
||||
CommonsModule::defineModule(uri, versionMajor, versionMinor);
|
||||
SettingModule::defineModule(uri, versionMajor, versionMinor);
|
||||
|
||||
ModelManager::registerMetaTypes();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue