mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(widget): replace screenGeometry() when using Qt 5.13
This commit is contained in:
parent
0ac5386786
commit
dfe75fb101
|
@ -20,6 +20,7 @@
|
||||||
#include "genericnetcamview.h"
|
#include "genericnetcamview.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QScreen>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
@ -136,8 +137,11 @@ void GenericNetCamView::enterFullScreen()
|
||||||
showFullScreen();
|
showFullScreen();
|
||||||
enterFullScreenButton->hide();
|
enterFullScreenButton->hide();
|
||||||
toggleMessagesButton->hide();
|
toggleMessagesButton->hide();
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
const auto screenSize = QApplication::desktop()->screenGeometry(this);
|
const auto screenSize = QGuiApplication::screenAt(this->pos())->geometry();
|
||||||
|
#else
|
||||||
|
const QRect screenSize = QApplication::desktop()->screenGeometry(this);
|
||||||
|
#endif
|
||||||
buttonPanel->setGeometry((screenSize.width() / 2) - buttonPanel->width() / 2,
|
buttonPanel->setGeometry((screenSize.width() / 2) - buttonPanel->width() / 2,
|
||||||
screenSize.height() - BTN_PANEL_HEIGHT - 25, BTN_PANEL_WIDTH, BTN_PANEL_HEIGHT);
|
screenSize.height() - BTN_PANEL_HEIGHT - 25, BTN_PANEL_WIDTH, BTN_PANEL_HEIGHT);
|
||||||
buttonPanel->show();
|
buttonPanel->show();
|
||||||
|
|
|
@ -203,7 +203,11 @@ void ScreenshotGrabber::chooseHelperTooltipText(QRect rect)
|
||||||
void ScreenshotGrabber::adjustTooltipPosition()
|
void ScreenshotGrabber::adjustTooltipPosition()
|
||||||
{
|
{
|
||||||
QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry();
|
QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry();
|
||||||
QRect rec = qApp->desktop()->screenGeometry(QCursor::pos());
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
|
const auto rec = QGuiApplication::screenAt(QCursor::pos())->geometry();
|
||||||
|
#else
|
||||||
|
const auto rec = qApp->desktop()->screenGeometry(QCursor::pos());
|
||||||
|
#endif
|
||||||
const QRectF ttRect = this->helperToolbox->childrenBoundingRect();
|
const QRectF ttRect = this->helperToolbox->childrenBoundingRect();
|
||||||
int x = qAbs(recGL.x()) + rec.x() + ((rec.width() - ttRect.width()) / 2);
|
int x = qAbs(recGL.x()) + rec.x() + ((rec.width() - ttRect.width()) / 2);
|
||||||
int y = qAbs(recGL.y()) + rec.y();
|
int y = qAbs(recGL.y()) + rec.y();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user