diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 59085eed9d9..baf306b41ac 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 { + } 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 f731b9443a3..45379488f77 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