diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-09-28 12:04:52 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-10-02 08:04:49 -0700 |
commit | cd98cb8921861b586724abed307bfead62e4b74a (patch) | |
tree | da4d108e7b8c0e693ce3beab996123aae6064941 | |
parent | fdfa540747e70e245b3c721dffa31b7c8470e187 (diff) | |
download | subsurface-cd98cb8921861b586724abed307bfead62e4b74a.tar.gz |
Mobile: add more debugging output for screen width issue
Somehow we need to be able to figure out which width information is
correct.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/main.qml | 1 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 1 | ||||
-rw-r--r-- | subsurface-helper.cpp | 9 |
3 files changed, 10 insertions, 1 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 51d591721..3390579fb 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -702,6 +702,7 @@ if you have network connectivity and want to sync your data to cloud storage."), rootItem.visible = true diveList.opacity = 1 rootItem.opacity = 1 + console.log("setting the defaultColumnWidth to " + Kirigami.Units.gridUnit * 21) pageStack.defaultColumnWidth = Kirigami.Units.gridUnit * 21 manager.appInitialized() } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 126cca7b8..fcb25e4a5 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1717,6 +1717,7 @@ void QMLManager::setDevicePixelRatio(qreal dpr, QScreen *screen) void QMLManager::screenChanged(QScreen *screen) { + qDebug("QMLManager received screen changed notification (%d,%d)", screen->size().width(), screen->size().height()); m_lastDevicePixelRatio = screen->devicePixelRatio(); emit sendScreenChanged(screen); } diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index 11b98611a..ba2f05703 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -10,6 +10,7 @@ #include "core/ssrf.h" #ifdef SUBSURFACE_MOBILE +#include <QApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include "mobile-widgets/qmlmanager.h" @@ -75,6 +76,8 @@ void run_ui() qDebug() << "Qt reports default font is set as" << defaultFont.family(); } #endif + QScreen *appScreen = QApplication::screens().at(0); + int availableScreenWidth = appScreen->availableSize().width(); QQmlApplicationEngine engine; register_qml_types(&engine); LOG_STP("run_ui qml engine started"); @@ -102,7 +105,7 @@ void run_ui() sortModel->sort(0, Qt::DescendingOrder); LOG_STP("run_ui diveListModel sorted"); GpsListModel gpsListModel; - QSortFilterProxyModel *gpsSortModel = new QSortFilterProxyModel(0); + QSortFilterProxyModel *gpsSortModel = new QSortFilterProxyModel(nullptr); gpsSortModel->setSourceModel(&gpsListModel); gpsSortModel->setDynamicSortFilter(true); gpsSortModel->setSortRole(GpsListModel::GpsWhenRole); @@ -118,6 +121,7 @@ void run_ui() ctxt->setContextProperty("logModel", MessageHandlerModel::self()); engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); + qDebug() << "loaded main.qml"; LOG_STP("run_ui qml loaded"); qqWindowObject = engine.rootObjects().value(0); if (!qqWindowObject) { @@ -128,6 +132,9 @@ void run_ui() qml_window->setIcon(QIcon(":subsurface-mobile-icon")); qDebug() << "qqwindow devicePixelRatio" << qml_window->devicePixelRatio() << qml_window->screen()->devicePixelRatio(); QScreen *screen = qml_window->screen(); + int qmlWW = qml_window->width(); + int qmlSW = screen->size().width(); + qDebug() << "qml_window reports width as" << qmlWW << "associated screen width" << qmlSW << "Qt screen reports width as" << availableScreenWidth; QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged); QMLManager *manager = QMLManager::instance(); LOG_STP("run_ui qmlmanager instance started"); |