SystemMonitor: Always center the dialog on the screen

Reviewed By: Aleix
wilder-5.14
Vishesh Handa 11 years ago
parent f3aea31a2b
commit 2b56c3b02e
  1. 10
      systemmonitor/ksystemactivitydialog.cpp

@ -26,11 +26,14 @@
#include <QAction>
#include <QTreeView>
#include <QIcon>
#include <QWindow>
#include <QDialog>
#include <QDBusConnection>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QScreen>
#include <QDesktopWidget>
#include <QTimer>
#include <KSharedConfig>
@ -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()

Loading…
Cancel
Save