eglfs: Enable use of Qt::AA_EnableHighDpiScaling

Support use of Qt::AA_EnableHighDpiScaling and 
QT_AUTO_SCREEN_SCALE_FACTOR.

This makes the high-dpi scaling system use the screen
configuration set with QT_QPA_EGLFS_PHYSICAL_WIDTH and
QT_QPA_EGLFS_PHYSICAL_HEIGHT.

Implement QEglFSScreen::pixelDensity() and make it return
the scale factor for the display. The scale factor is computed
as the ratio of the logical DPI to the base DPI.

Change-Id: I14ed5da058024128479cb5508e056c39bd2f7563
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Morten Johan Sørvig 2015-11-16 13:41:40 +00:00
parent 08f9a1bd6a
commit d98415dd6b
4 changed files with 12 additions and 0 deletions

View File

@ -219,6 +219,11 @@ QDpi QEGLDeviceIntegration::logicalDpi() const
25.4 * s.height() / ps.height());
}
qreal QEGLDeviceIntegration::pixelDensity() const
{
return logicalDpi().first / qreal(100);
}
Qt::ScreenOrientation QEGLDeviceIntegration::nativeOrientation() const
{
return Qt::PrimaryOrientation;

View File

@ -75,6 +75,7 @@ public:
virtual QSizeF physicalScreenSize() const;
virtual QSize screenSize() const;
virtual QDpi logicalDpi() const;
virtual qreal pixelDensity() const;
virtual Qt::ScreenOrientation nativeOrientation() const;
virtual Qt::ScreenOrientation orientation() const;
virtual int screenDepth() const;

View File

@ -82,6 +82,11 @@ QDpi QEglFSScreen::logicalDpi() const
return qt_egl_device_integration()->logicalDpi();
}
qreal QEglFSScreen::pixelDensity() const
{
return qt_egl_device_integration()->pixelDensity();
}
Qt::ScreenOrientation QEglFSScreen::nativeOrientation() const
{
return qt_egl_device_integration()->nativeOrientation();

View File

@ -55,6 +55,7 @@ public:
QSizeF physicalSize() const Q_DECL_OVERRIDE;
QDpi logicalDpi() const Q_DECL_OVERRIDE;
qreal pixelDensity() const Q_DECL_OVERRIDE;
Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE;
Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;