Use QApplication::screens().first() instead of deprecated methods

Also follows-up moving away from QDesktop widget from c99f12e8fe
Note: `QScreen::availableGeometry()` doesn't take the parent argument as opposed to `QDesktopWidget::availableGeometry(QWidget &xd)` - no idea if not passing an argument breaks anything, but just for the sake of having Chatterino compile I didn't mind it that much while fixing compilation.

Reference:
- https://doc.qt.io/qt-6/widgets-changes-qt6.html#qdesktopwidget-and-qapplication-desktop
This commit is contained in:
zneix 2021-07-31 22:51:34 +02:00
parent d6450a8f78
commit e2f59d2e61
No known key found for this signature in database
GPG key ID: 911916E0523B22F6
4 changed files with 6 additions and 8 deletions

View file

@ -15,6 +15,7 @@
#include <QDebug>
#include <QFont>
#include <QIcon>
#include <QScreen>
#include <functional>
#ifdef CHATTERINO
@ -601,10 +602,10 @@ void BaseWindow::moveIntoDesktopRect(QWidget *parent, QPoint point)
return;
// move the widget into the screen geometry if it's not already in there
QDesktopWidget *desktop = QApplication::desktop();
auto *desktop = QApplication::screens().first();
QPoint globalCursorPos = QCursor::pos();
QRect s = desktop->availableGeometry(parent);
QRect s = desktop->availableGeometry(/*parent*/);
bool stickRight = false;
bool stickBottom = false;

View file

@ -5,9 +5,7 @@
#include "widgets/helper/ChannelView.hpp"
#include <QApplication>
#include <QDesktopWidget>
#include <QScreen>
#include <QVBoxLayout>
namespace chatterino {
@ -32,7 +30,7 @@ void NotificationPopup::updatePosition()
{
Location location = BottomRight;
QDesktopWidget *desktop = QApplication::desktop();
auto *desktop = QApplication::screens().first();
const QRect rect = desktop->availableGeometry();
switch (location)

View file

@ -2,7 +2,6 @@
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QPainter>
#include "BaseTheme.hpp"
@ -345,7 +344,8 @@ void Button::showMenu()
return;
auto point = [this] {
auto bounds = QApplication::desktop()->availableGeometry(this);
auto bounds =
QApplication::screens().first()->availableGeometry(/*this*/);
auto point = this->mapToGlobal(
QPoint(this->width() - this->menu_->width(), this->height()));

View file

@ -22,7 +22,6 @@
#include "widgets/splits/Split.hpp"
#include "widgets/splits/SplitContainer.hpp"
#include <QDesktopWidget>
#include <QDrag>
#include <QHBoxLayout>
#include <QInputDialog>