From b45f0e3e466deb0e5e1c64d2baa444216c22c883 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sat, 20 Oct 2018 12:18:33 +0200 Subject: [PATCH] Enable high-DPI scaling to support 4k screens. This enables coordinate system scaling for high-DPI displays, which enforces correct proportions even on small 4k displays. The icons are scaled up without interpolation, which makes them crisp, but a bit pixelated. A new scalable icon set will solve this problem, but is not scope of this patch. Resolves #548, #1381, #1710, #1888 In addition, this patch enforces the KeePassXC icon theme for the KMessageBox close icon, since using the system theme produces very ugly icons on some Linux systems. --- src/gui/KMessageWidget.cpp | 2 +- src/main.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/KMessageWidget.cpp b/src/gui/KMessageWidget.cpp index acd6509bb0..910f0c91bb 100644 --- a/src/gui/KMessageWidget.cpp +++ b/src/gui/KMessageWidget.cpp @@ -94,7 +94,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr) QAction *closeAction = new QAction(q); closeAction->setText(KMessageWidget::tr("&Close")); closeAction->setToolTip(KMessageWidget::tr("Close message")); - closeAction->setIcon(FilePath::instance()->icon("actions", "message-close")); + closeAction->setIcon(FilePath::instance()->icon("actions", "message-close", false)); QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide())); diff --git a/src/main.cpp b/src/main.cpp index a37648ec1c..2a1fa324c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,6 +46,10 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) int main(int argc, char** argv) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + Application app(argc, argv); Application::setApplicationName("keepassxc"); Application::setApplicationVersion(KEEPASSXC_VERSION);