From 1dc7ffee4ee0012c697a6a9909fdaf40cc098c9b Mon Sep 17 00:00:00 2001 From: Nikolay Zlatev Date: Wed, 11 Nov 2020 10:20:22 +0200 Subject: [PATCH] Enable HiDPI on Windows (#2469) * Enable HiDPI on Windows * Fix build with MSVC2019 (use of overloaded operator'=' is ambiguous) Co-authored-by: Nikolay Zlatev --- src/RemoteCommitsModel.cpp | 2 +- src/main.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/RemoteCommitsModel.cpp b/src/RemoteCommitsModel.cpp index a114ced2..056af152 100644 --- a/src/RemoteCommitsModel.cpp +++ b/src/RemoteCommitsModel.cpp @@ -83,7 +83,7 @@ void RemoteCommitsModel::refresh(const std::string& json_data, const std::string item->setFont(0, bold_font); } - parent_id = commit["parent"]; + parent_id = commit["parent"].get(); } // Refresh the view diff --git a/src/main.cpp b/src/main.cpp index 7a3ca36b..b7c1ad6c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,13 @@ int main( int argc, char ** argv ) { #ifdef Q_OS_WIN +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif +#endif + QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); // In Windows, there is no output to terminal for a graphical application, so we install // the output to message box, until the main window is shown or the application exits. qInstallMessageHandler(boxMessageOutput);