Skip to content

Commit

Permalink
Remove QPlatformScreen::pixelDensity()
Browse files Browse the repository at this point in the history
This function is no longer in use - Qt Gui now computes
scale factors based on logicalDpi() and logicalBaseDpi()
instead.

Change-Id: Ieb4b75ef4e1563694a8e12b7cdd1f60c419d5bf2
Reviewed-by: Tor Arne Vestbø <[email protected]>
Morten Johan Sørvig committed Oct 5, 2020
1 parent 9103d82 commit f84ba31
Showing 8 changed files with 0 additions and 42 deletions.
19 changes: 0 additions & 19 deletions src/gui/kernel/qplatformscreen.cpp
Original file line number Diff line number Diff line change
@@ -215,31 +215,12 @@ QDpi QPlatformScreen::logicalBaseDpi() const
implementation returns 1.0.
\sa QPlatformWindow::devicePixelRatio()
\sa QPlatformScreen::pixelDensity()
*/
qreal QPlatformScreen::devicePixelRatio() const
{
return 1.0;
}

/*!
Reimplement this function in subclass to return the pixel density of the
screen. This is the scale factor needed to make a low-dpi application
usable on this screen. The default implementation returns 1.0.
Returning something else than 1.0 from this function causes Qt to
apply the scale factor to the application's coordinate system.
This is different from devicePixelRatio, which reports a scale
factor already applied by the windowing system. A platform plugin
typically implements one (or none) of these two functions.
\sa QPlatformWindow::devicePixelRatio()
*/
qreal QPlatformScreen::pixelDensity() const
{
return 1.0;
}

/*!
Reimplement this function in subclass to return the vertical refresh rate
of the screen, in Hz.
1 change: 0 additions & 1 deletion src/gui/kernel/qplatformscreen.h
Original file line number Diff line number Diff line change
@@ -119,7 +119,6 @@ class Q_GUI_EXPORT QPlatformScreen
virtual QDpi logicalDpi() const;
virtual QDpi logicalBaseDpi() const;
virtual qreal devicePixelRatio() const;
virtual qreal pixelDensity() const;

virtual qreal refreshRate() const;

5 changes: 0 additions & 5 deletions src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
Original file line number Diff line number Diff line change
@@ -234,11 +234,6 @@ QDpi QEglFSDeviceIntegration::logicalDpi() const
return QDpi(100, 100);
}

qreal QEglFSDeviceIntegration::pixelDensity() const
{
return qMax(1, qRound(logicalDpi().first / qreal(100)));
}

Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const
{
return Qt::PrimaryOrientation;
Original file line number Diff line number Diff line change
@@ -80,7 +80,6 @@ class Q_EGLFS_EXPORT QEglFSDeviceIntegration
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;
5 changes: 0 additions & 5 deletions src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
Original file line number Diff line number Diff line change
@@ -115,11 +115,6 @@ 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();
1 change: 0 additions & 1 deletion src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ class Q_EGLFS_EXPORT QEglFSScreen : public QPlatformScreen

QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
qreal pixelDensity() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;

Original file line number Diff line number Diff line change
@@ -85,11 +85,6 @@ QDpi QEglFSEmulatorScreen::logicalDpi() const
return QDpi(100, 100);
}

qreal QEglFSEmulatorScreen::pixelDensity() const
{
return m_pixelDensity;
}

qreal QEglFSEmulatorScreen::refreshRate() const
{
return m_refreshRate;
@@ -163,9 +158,6 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description)
m_physicalSize.setHeight(value.toInt());
}

value = description.value(QLatin1String("pixelDensity"));
if (!value.isUndefined() && value.isDouble())
m_pixelDensity = value.toDouble();

value = description.value(QLatin1String("refreshRate"));
if (!value.isUndefined() && value.isDouble())
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ class QEglFSEmulatorScreen : public QEglFSScreen
QImage::Format format() const override;
QSizeF physicalSize() const override;
QDpi logicalDpi() const override;
qreal pixelDensity() const override;
qreal refreshRate() const override;
Qt::ScreenOrientation nativeOrientation() const override;
Qt::ScreenOrientation orientation() const override;
@@ -74,7 +73,6 @@ class QEglFSEmulatorScreen : public QEglFSScreen
int m_depth;
QImage::Format m_format;
QSizeF m_physicalSize;
float m_pixelDensity;
float m_refreshRate;
Qt::ScreenOrientation m_nativeOrientation;
Qt::ScreenOrientation m_orientation;

0 comments on commit f84ba31

Please sign in to comment.