summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-04-19 10:54:09 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-04-19 10:56:45 (GMT)
commita43355f7d10a72f60719f7e5a617bcd0031f8fba (patch)
tree4f7a31cf1732924e27a703cb0eaa5a731b40c3b5 /src/gui
parent4e42cea17031ff90481a674686afdd5548fba4a9 (diff)
downloadQt-a43355f7d10a72f60719f7e5a617bcd0031f8fba.zip
Qt-a43355f7d10a72f60719f7e5a617bcd0031f8fba.tar.gz
Qt-a43355f7d10a72f60719f7e5a617bcd0031f8fba.tar.bz2
QPlatformScreen now has default implementation for physicalSize
assuming dpi = 100. This also simplifies minimal slightly. Also use propper apis in qfont for default dpi by using QPlatformScreen
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformscreen_lite.cpp8
-rw-r--r--src/gui/kernel/qplatformscreen_lite.h2
-rw-r--r--src/gui/text/qfont.cpp14
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