Update MainWindow::centerToScreen().

This commit is contained in:
iaom 2021-08-19 10:22:20 +08:00
parent 33ed0d30ea
commit 225d93cdae
1 changed files with 10 additions and 10 deletions

View File

@ -402,16 +402,16 @@ void MainWindow::centerToScreen(QWidget* widget) {
int desk_y = desk_rect.height();
int x = widget->width();
int y = widget->height();
QDBusInterface primaryScreenInterface("org.ukui.SettingsDaemon",
"/org/ukui/SettingsDaemon/wayland",
"org.ukui.SettingsDaemon.wayland",
QDBusConnection::sessionBus());
if(QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
QDBusReply<int> width = primaryScreenInterface.call("width");
QDBusReply<int> height = primaryScreenInterface.call("height");
desk_x = width;
desk_y = height;
}
// QDBusInterface primaryScreenInterface("org.ukui.SettingsDaemon",
// "/org/ukui/SettingsDaemon/wayland",
// "org.ukui.SettingsDaemon.wayland",
// QDBusConnection::sessionBus());
// if(QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
// QDBusReply<int> width = primaryScreenInterface.call("width");
// QDBusReply<int> height = primaryScreenInterface.call("height");
// desk_x = width;
// desk_y = height;
// }
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 3 + desk_rect.top());
}