Keep a singleton ComputerManager outside of the Models

This commit is contained in:
Cameron Gutman
2018-07-05 22:08:55 -07:00
parent 0d26ef7e5c
commit 1b1ad86271
9 changed files with 72 additions and 24 deletions

View File

@@ -30,6 +30,11 @@ int main(int argc, char *argv[])
// Register our C++ types for QML
qmlRegisterType<ComputerModel>("ComputerModel", 1, 0, "ComputerModel");
qmlRegisterType<AppModel>("AppModel", 1, 0, "AppModel");
qmlRegisterSingletonType<ComputerManager>("ComputerManager", 1, 0,
"ComputerManager",
[](QQmlEngine*, QJSEngine*) -> QObject* {
return new ComputerManager();
});
// Load the main.qml file
QQmlApplicationEngine engine;