Remove Deprecated QDesktopWidget (#4287)

* fix: remove deprecated `QDesktopWidget`

* chore: add changelog entry
This commit is contained in:
nerix
2023-01-07 11:41:39 +01:00
committed by GitHub
parent e48945e370
commit 95b1f82620
7 changed files with 33 additions and 30 deletions
+8 -3
View File
@@ -5,8 +5,8 @@
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QPainter>
#include <QScreen>
namespace chatterino {
namespace {
@@ -345,11 +345,16 @@ void Button::showMenu()
return;
auto point = [this] {
auto bounds = QApplication::desktop()->availableGeometry(this);
auto point = this->mapToGlobal(
QPoint(this->width() - this->menu_->width(), this->height()));
auto *screen = QApplication::screenAt(point);
if (screen == nullptr)
{
screen = QApplication::primaryScreen();
}
auto bounds = screen->availableGeometry();
if (point.y() + this->menu_->height() > bounds.bottom())
{
point.setY(point.y() - this->menu_->height() - this->height());