Merge branch '0720-newfrontend' into 'new-frontend'

Update MainWindow::centerToScreen().

See merge request kylin-desktop/ukui-search!97
This commit is contained in:
PengfeiZhang 2021-08-19 03:12:12 +00:00
commit d9c4d339ea
1 changed files with 10 additions and 10 deletions

View File

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