Skip to content
Permalink
Browse files

Simplify wstring to QString conversion

  • Loading branch information
tinyredpanda committed Nov 23, 2019
1 parent a06da59 commit 5dbabef355a00cc726cc08443c96517564f9bea0
Showing with 5 additions and 7 deletions.
  1. +5 −7 Source/Core/DolphinQt/Main.cpp
@@ -5,8 +5,6 @@
#ifdef _WIN32
#include <Windows.h>
#include <cstdio>

#include "Common/StringUtil.h"
#endif

#include <OptionParser.h>
@@ -104,16 +102,16 @@ int main(int argc, char* argv[])

#ifdef _WIN32
// Get the default system font because Qt's way of obtaining it is outdated
NONCLIENTMETRICS metrics = {};
LOGFONT& logfont = metrics.lfMenuFont;
metrics.cbSize = sizeof(NONCLIENTMETRICS);
NONCLIENTMETRICSW metrics = {};
LOGFONTW& logfont = metrics.lfMenuFont;
metrics.cbSize = sizeof(metrics);

if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0))
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0))
{
// Sadly Qt 5 doesn't support turning a native font handle into a QFont so this is the next best
// thing
QFont font = QApplication::font();
font.setFamily(QString::fromStdString(UTF16ToUTF8(logfont.lfFaceName)));
font.setFamily(QString::fromStdWString(logfont.lfFaceName));

font.setItalic(logfont.lfItalic);
font.setStrikeOut(logfont.lfStrikeOut);

0 comments on commit 5dbabef

Please sign in to comment.
You can’t perform that action at this time.