summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Holzammer <andreas.holzammer@kdab.com>2012-09-21 08:33:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-24 18:02:13 +0200
commit03f4930ecab95a793601666c1f4a73c207fa1f4d (patch)
tree75fe7efae9ce84fa32cddd39e25929ab06e77e05 /src
parentd16efdfc0ef5f998d58dbfe6015a6f0a961d0fae (diff)
Try to auto-detect the font rendering for WinCE
Native font rendering is broken for QML applications, use free type rendering for those scenarios. Use native rendering for all other applications. Use a workaround to find out if we are running a QML application on the target. Related to QTBUG-24205. Change-Id: I653ea579098db1e58af8176cb2c3f943be0b9602 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp37
-rw-r--r--src/plugins/platforms/windows/windows.pro1
2 files changed, 34 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 59085eed9d..baf306b41a 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -339,7 +339,8 @@ QPlatformOpenGLContext
enum FontDatabaseOption {
FontDatabaseFreeType,
- FontDatabaseNative
+ FontDatabaseNative,
+ FontDatabaseAuto
};
static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterface)
@@ -352,22 +353,50 @@ static inline FontDatabaseOption fontDatabaseOption(const QObject &nativeInterfa
if (argument == QLatin1String("native"))
return FontDatabaseNative;
}
- return FontDatabaseNative;
+ return FontDatabaseAuto;
}
+#ifdef Q_OS_WINCE
+// It's not easy to detect if we are running a QML application
+// Let's try to do so by checking if the QtQuick module is loaded.
+inline bool isQMLApplication()
+{
+ // check if the QtQuick library is loaded
+#ifdef _DEBUG
+ HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"d5.dll");
+#else
+ HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"5.dll");
+#endif
+ return (handle != NULL);
+}
+#endif
+
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
{
if (!d->m_fontDatabase) {
#ifdef QT_NO_FREETYPE
d->m_fontDatabase = new QWindowsFontDatabase();
-#else
+#else // QT_NO_FREETYPE
FontDatabaseOption option = fontDatabaseOption(d->m_nativeInterface);
if (option == FontDatabaseFreeType) {
d->m_fontDatabase = new QWindowsFontDatabaseFT;
+ } else if (option == FontDatabaseNative){
+ d->m_fontDatabase = new QWindowsFontDatabase;
} else {
+#ifndef Q_OS_WINCE
d->m_fontDatabase = new QWindowsFontDatabase;
- }
+#else
+ if (isQMLApplication()) {
+ if (QWindowsContext::verboseIntegration) {
+ qDebug() << "QML application detected, using FreeType rendering";
+ }
+ d->m_fontDatabase = new QWindowsFontDatabaseFT;
+ }
+ else
+ d->m_fontDatabase = new QWindowsFontDatabase;
#endif
+ }
+#endif // QT_NO_FREETYPE
}
return d->m_fontDatabase;
}
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index f731b9443a..45379488f7 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -18,6 +18,7 @@ win32-g++*: LIBS *= -luuid
# For the dialog helpers:
!wince*:LIBS *= -lshlwapi -lshell32
!wince*:LIBS *= -ladvapi32
+wince*:DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\""
DEFINES *= QT_NO_CAST_FROM_ASCII