From 48ff3280b1e753040c965f6476831b20e075b825 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Mon, 11 May 2020 12:50:07 +0800 Subject: [PATCH] UNIX helper: Use QSize instead of QRect We only need the size, not the geometry. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- framelesshelper.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/framelesshelper.cpp b/framelesshelper.cpp index 3c1811b..dacc227 100644 --- a/framelesshelper.cpp +++ b/framelesshelper.cpp @@ -100,9 +100,9 @@ void FramelessHelper::moveWindowToDesktopCenter(QObject *const obj) { if (obj->isWindowType()) { const auto window = qobject_cast(obj); if (window) { - const QRect sg = window->screen()->geometry(); - const int sw = sg.width(); - const int sh = sg.height(); + const QSize ss = window->screen()->size(); + const int sw = ss.width(); + const int sh = ss.height(); const int ww = window->width(); const int wh = window->height(); window->setX(qRound(static_cast(sw - ww) / 2.0)); @@ -113,9 +113,9 @@ void FramelessHelper::moveWindowToDesktopCenter(QObject *const obj) { else if (obj->isWidgetType()) { const auto widget = qobject_cast(obj); if (widget && widget->isTopLevel()) { - const QRect sg = widget->screen()->geometry(); - const int sw = sg.width(); - const int sh = sg.height(); + const QSize ss = widget->screen()->size(); + const int sw = ss.width(); + const int sh = ss.height(); const int ww = widget->width(); const int wh = widget->height(); widget->move(qRound(static_cast(sw - ww) / 2.0),