QML UI: pass initial screen information to QMLManager

And make sure updates are delivered as they appear.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-03-08 19:35:22 -08:00
parent f798132862
commit 298235eec7

View file

@ -12,6 +12,7 @@
#include "qt-gui.h"
#include <QQuickWindow>
#include <QScreen>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSortFilterProxyModel>
@ -70,6 +71,12 @@ void run_ui()
QQuickWindow *qml_window = qobject_cast<QQuickWindow *>(qqWindowObject);
qml_window->setIcon(QIcon(":/subsurface-mobile-icon"));
qqWindowObject->setProperty("messageText", QVariant("Subsurface-mobile startup"));
qDebug() << "qqwindow devicePixelRatio" << qml_window->devicePixelRatio() << qml_window->screen()->devicePixelRatio();
QScreen *screen = qml_window->screen();
QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged);
QMLManager::instance()->screenChanged(screen);
qDebug() << "qqwindow screen has ldpi/pdpi" << screen->logicalDotsPerInch() << screen->physicalDotsPerInch();
#if !defined(Q_OS_ANDROID)
qml_window->setHeight(1200);
qml_window->setWidth(800);