From 920795e99a05d1dc419cee88f1b0b2dcd3473dfc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Feb 2012 14:40:02 +0100 Subject: Windows QPA: Compile with QT_NO_CAST_FROM_ASCII, warnings. Change-Id: I75d6a102a6a1fa0b5f8add049442f23d6fd57725 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 +- .../platforms/windows/qwindowsfontdatabase_ft.cpp | 16 +++++++++------- src/plugins/platforms/windows/windows.pro | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 02411d3daf..5f7dfb1b10 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -346,7 +346,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) uint style = 0; bool icon = false; - QString cname = "Qt5"; + QString cname = QStringLiteral("Qt5"); if (w && isGL) { cname += QStringLiteral("QGLWindow"); style = CS_DBLCLKS|CS_OWNDC; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index e96305e4b7..52ff9fbb52 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -109,7 +109,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, if (familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) return false; - const int separatorPos = familyName.indexOf("::"); + const int separatorPos = familyName.indexOf(QStringLiteral("::")); const QString faceName = separatorPos != -1 ? familyName.left(separatorPos) : familyName; const QString fullName = @@ -169,7 +169,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, writingSystems.setSupported(ws); } - const QSettings fontRegistry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", + const QSettings fontRegistry(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"), QSettings::NativeFormat); struct FontKey @@ -189,7 +189,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, FontKey fontKey(key); QString realKey = key; - realKey = realKey.remove(trueType); + realKey.remove(trueType); const QStringList fonts = realKey.trimmed().split(QLatin1Char('&')); foreach (const QString &font, fonts) fontKey.fonts.push_back(font.trimmed()); @@ -198,14 +198,14 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, } } - QByteArray value; + QString value; int index = 0; for (int k = 0; k < allFonts.size(); ++k) { const FontKey &fontKey = allFonts.at(k); for (int i = 0; i < fontKey.fonts.length(); ++i) { const QString font = fontKey.fonts[i]; if (font == faceName || (faceName != fullName && fullName == font)) { - value = fontRegistry.value(fontKey.key).toByteArray(); + value = fontRegistry.value(fontKey.key).toString(); index = i; break; } @@ -218,7 +218,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, return false; if (!QDir::isAbsolutePath(value)) - value = qgetenv("windir") + "\\Fonts\\" + value; + value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\")); // Pointer is deleted in QBasicFontDatabase::releaseHandle(void *handle) FontFile *fontFile = new FontFile; @@ -244,7 +244,9 @@ static int CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, int type, LPARAM namesSetIn) { typedef QSet StringSet; - const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName) + "::" + QString::fromWCharArray(f->elfFullName); + const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName) + + QStringLiteral("::") + + QString::fromWCharArray(f->elfFullName); const QString script = QString::fromWCharArray(f->elfScript); const FONTSIGNATURE signature = textmetric->ntmFontSig; diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index ef8c69d18d..453265405a 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -14,6 +14,8 @@ win32-g++: LIBS *= -luuid # For the dialog helpers: LIBS *= -lshlwapi -lShell32 +DEFINES *= QT_NO_CAST_FROM_ASCII + contains(QT_CONFIG, directwrite) { LIBS *= -ldwrite SOURCES += qwindowsfontenginedirectwrite.cpp -- cgit v1.2.3