From 2b56c3b02e8f41417ec85ecf3683159bae0bcebe Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Fri, 29 May 2015 19:28:55 +0200 Subject: [PATCH] SystemMonitor: Always center the dialog on the screen Reviewed By: Aleix --- systemmonitor/ksystemactivitydialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/systemmonitor/ksystemactivitydialog.cpp b/systemmonitor/ksystemactivitydialog.cpp index b45d3f1e8..ecbbdc17b 100644 --- a/systemmonitor/ksystemactivitydialog.cpp +++ b/systemmonitor/ksystemactivitydialog.cpp @@ -26,11 +26,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include #include #include @@ -80,6 +83,13 @@ void KSystemActivityDialog::slotInit() QDBusConnection con = QDBusConnection::sessionBus(); con.registerObject(QStringLiteral("/"), this, QDBusConnection::ExportAllSlots); + + QRect geom = windowHandle()->screen()->geometry(); + QSize ourSize = windowHandle()->size(); + + int w = ourSize.width(); + int h = ourSize.height(); + setGeometry((geom.width() - w)/2, (geom.height() - h)/2, w, h); } void KSystemActivityDialog::run()