ViewSolutions 1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Loading...
Searching...
No Matches
viewsolutions.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2020-2025 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8#include "variantlistmodel.h"
9#include "viewsolutions.h"
10#include <QQmlContext>
11#include <qmlcolorpicker.h>
12#include <QQmlApplicationEngine>
13#include <QFile>
14#include <QDir>
15#include <modelstorage.h>
16
17namespace ViewSolutions {
18QSharedPointer<ModelStorage> init(QQmlEngine *engine) {
19
20 if (!engine)
21 return nullptr;
22
23 auto root = engine->rootContext();
24 if (!root)
25 return nullptr;
26
28
29 auto&& storage = QSharedPointer<ModelStorage>::create(engine);
30 QQmlEngine::setObjectOwnership(storage.get(), QQmlEngine::CppOwnership);
31
32 root->setContextProperty("modelsStorage", storage.get());
33
34 auto&& picker = QSharedPointer<QMLColorPicker>::create();
35 storage->addModel(picker);
36
37 // to-do - remove
38 root->setContextProperty("colorPicker", picker.get());
39
40 qRegisterMetaType<VariantListModel>("VariantListModel");
41
42 return storage;
43}
44}
The ViewSolutions namespace.
QSharedPointer< ModelStorage > init(QQmlEngine *engine)
init this method import all qml resources to your project and creates the central model storage of th...
void initResources()
initResources loads the QML resources of the ViewSolutions module.