mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
cleanup: move initialization of QMLInterface
QMLInterface was initialized in the register_qml_types function. Therein, it was in an if branch that tested whether the passed-in engine argument was not NULL. However, on mobile this could never be NULL. Let's just move the initialization out of that function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2db6b16a70
commit
53b216b228
1 changed files with 4 additions and 8 deletions
|
@ -80,6 +80,10 @@ void run_ui()
|
|||
QScreen *appScreen = QApplication::screens().at(0);
|
||||
int availableScreenWidth = appScreen->availableSize().width();
|
||||
QQmlApplicationEngine engine;
|
||||
QQmlContext *ctxt = engine.rootContext();
|
||||
|
||||
// Register qml interface classes
|
||||
QMLInterface::setup(ctxt);
|
||||
register_qml_types(&engine);
|
||||
KirigamiPlugin::getInstance().registerTypes();
|
||||
#if defined(__APPLE__) && !defined(Q_OS_IOS)
|
||||
|
@ -101,7 +105,6 @@ void run_ui()
|
|||
gpsSortModel->setDynamicSortFilter(true);
|
||||
gpsSortModel->setSortRole(GpsListModel::GpsWhenRole);
|
||||
gpsSortModel->sort(0, Qt::DescendingOrder);
|
||||
QQmlContext *ctxt = engine.rootContext();
|
||||
ctxt->setContextProperty("gpsModel", gpsSortModel);
|
||||
ctxt->setContextProperty("vendorList", vendorList);
|
||||
ctxt->setContextProperty("swipeModel", MobileModels::instance()->swipeModel());
|
||||
|
@ -195,13 +198,6 @@ void register_qml_types(QQmlEngine *engine)
|
|||
int rc;
|
||||
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
if (engine != NULL) {
|
||||
QQmlContext *ct = engine->rootContext();
|
||||
|
||||
// Register qml interface classes
|
||||
QMLInterface::setup(ct);
|
||||
}
|
||||
|
||||
REGISTER_TYPE(QMLManager, "QMLManager");
|
||||
REGISTER_TYPE(QMLProfile, "QMLProfile");
|
||||
REGISTER_TYPE(DiveImportedModel, "DCImportModel");
|
||||
|
|
Loading…
Reference in a new issue