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