fix default font issue of Qt

This commit is contained in:
Rafael 2016-04-08 14:36:49 +02:00
parent de18060e6c
commit 883c936ab2
2 changed files with 27 additions and 0 deletions

View file

@ -103,7 +103,11 @@ DISTFILES += res/app.rc \
INCLUDEPATH += ./uimod
# WINDOWS ONLY
win32: DEFINES += GTA5SYNC_WIN
win32: RC_FILE += res/app.rc
win32: LIBS += -luser32
# QT4 ONLY STUFF

View file

@ -28,19 +28,42 @@
#include <QApplication>
#include <QStringList>
#include <QTranslator>
#include <QMessageBox>
#include <QFileInfo>
#include <QRawFont>
#include <QObject>
#include <QString>
#include <QDebug>
#include <QFont>
#include <QFile>
#include <QDir>
#ifdef GTA5SYNC_WIN
#include "windows.h"
#include <iostream>
#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setApplicationName("gta5sync");
a.setApplicationVersion("1.0.0");
#ifdef GTA5SYNC_WIN
// Get Windows Font
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(ncm);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
LOGFONTW uiFont = ncm.lfMessageFont;
char faceName[32];
char DefChar = ' ';
WideCharToMultiByte(CP_ACP, 0, uiFont.lfFaceName, -1, faceName, 32, &DefChar, NULL);
std::string uiFontStr(faceName);
QFont appFont(QString::fromStdString(uiFontStr), 9);
a.setFont(appFont);
#endif
QDir appDir = QFileInfo(a.applicationFilePath()).absoluteDir();
if (appDir.cd("plugins"))
{