Changeset 01d091fb in subsurface


Ignore:
Timestamp:
Apr 4, 2017, 11:00:18 AM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
89d7dd43
Parents:
e700ea9
git-author:
Dirk Hohndel <dirk@…> (04/03/17 17:29:06)
git-committer:
Dirk Hohndel <dirk@…> (04/04/17 11:00:18)
Message:

QML UI: better handling of device pixel ratio

In order to make sure we don't render the initial profiles with the
wrong scale on devices, we need to seed the device pixel ratio with the
device default and then update it once the window has been created.

Signed-off-by: Dirk Hohndel <dirk@…>

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qmlmanager.cpp

    rbd0c99d r01d091fb  
    8686        m_selectedDiveTimestamp(0),
    8787        m_credentialStatus(UNKNOWN),
    88         m_lastDevicePixelRatio(1.0),
    8988        alreadySaving(false)
    9089{
    9190        m_instance = this;
     91        m_lastDevicePixelRatio = qApp->devicePixelRatio();
    9292        connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
    9393        appendTextToLog(getUserAgent());
     
    14131413}
    14141414
     1415void QMLManager::setDevicePixelRatio(qreal dpr, QScreen *screen)
     1416{
     1417        if (m_lastDevicePixelRatio != dpr) {
     1418                m_lastDevicePixelRatio = dpr;
     1419                emit sendScreenChanged(screen);
     1420        }
     1421}
     1422
    14151423void QMLManager::screenChanged(QScreen *screen)
    14161424{
  • mobile-widgets/qmlmanager.h

    r674d833 r01d091fb  
    155155        void screenChanged(QScreen *screen);
    156156        qreal lastDevicePixelRatio();
     157        void setDevicePixelRatio(qreal dpr, QScreen *screen);
    157158        void appendTextToLog(const QString &newText);
    158159        void quit();
  • subsurface-mobile-helper.cpp

    rc52688c r01d091fb  
    8080        QObject::connect(qml_window, &QQuickWindow::screenChanged, QMLManager::instance(), &QMLManager::screenChanged);
    8181        QMLManager *manager = QMLManager::instance();
     82        manager->setDevicePixelRatio(qml_window->devicePixelRatio(), qml_window->screen());
    8283        manager->dlSortModel = sortModel;
    8384        manager->screenChanged(screen);
Note: See TracChangeset for help on using the changeset viewer.