diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-04-21 08:28:30 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-04-21 08:32:52 +0200 |
commit | 66e4d48129d6baa405ed9a4a22b12913227a8c45 (patch) | |
tree | 358f8515f6a83d33e2f89942e2d0f358452f6fdd /src/gui/text/qfont.cpp | |
parent | a43355f7d10a72f60719f7e5a617bcd0031f8fba (diff) |
Renamed createWindowSurfaceForWindow
to createWindowSurface. Gave also a default dpi when there is no
platform integration, ie. it has not been initialised yet or is being
initialised.
Diffstat (limited to 'src/gui/text/qfont.cpp')
-rw-r--r-- | src/gui/text/qfont.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 81d431ce3e..2c2ceb1b8b 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -177,10 +177,16 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_LITE) - 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))); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + if (pi) { + 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))); + } else { + //PI has not been initialised, or it is being initialised. Give a default dpi + dpi = 100; + } #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiX; #endif // Q_WS_X11 @@ -210,10 +216,16 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_LITE) - 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))); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + if (pi) { + 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))); + } else { + //PI has not been initialised, or it is being initialised. Give a default dpi + dpi = 100; + } #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiY; #endif // Q_WS_X11 |