diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformscreen_lite.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen_lite.h | 2 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 14 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp index 4492463..4c0a02b 100644 --- a/src/gui/kernel/qplatformscreen_lite.cpp +++ b/src/gui/kernel/qplatformscreen_lite.cpp @@ -56,3 +56,11 @@ QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const return 0; } +QSize QPlatformScreen::physicalSize() const +{ + static const int dpi = 100; + int width = geometry().width() / dpi * qreal(25.4) ; + int height = geometry().height() / dpi * qreal(25.4) ; + return QSize(width,height); +} + diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h index cae5f42..7d0e28d 100644 --- a/src/gui/kernel/qplatformscreen_lite.h +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -62,7 +62,7 @@ public: virtual QRect availableGeometry() const {return geometry();}; virtual int depth() const = 0; virtual QImage::Format format() const = 0; - virtual QSize physicalSize() const = 0; + virtual QSize physicalSize() const; virtual void setDirty(const QRect &) {} virtual QWidget *topLevelAt(const QPoint &point) const; }; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 01e4ef6..81d431c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -75,6 +75,10 @@ #ifdef Q_OS_SYMBIAN #include "qt_s60_p.h" #endif +#ifdef Q_WS_LITE +#include <QtGui/qplatformscreen_lite.h> +#include <QtGui/private/qapplication_p.h> +#endif #include <QMutexLocker> @@ -173,7 +177,10 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_LITE) - dpi = 72; + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4))); #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiX; #endif // Q_WS_X11 @@ -203,7 +210,10 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_LITE) - dpi = 72; + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4))); #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiY; #endif // Q_WS_X11 |