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),