Qt: Fix render size not matching window size
This commit is contained in:
parent
b84806ed8d
commit
8536e31136
|
@ -2,8 +2,12 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QScreen>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
@ -75,7 +79,11 @@ void RenderWidget::HandleCursorTimer()
|
||||||
void RenderWidget::showFullScreen()
|
void RenderWidget::showFullScreen()
|
||||||
{
|
{
|
||||||
QWidget::showFullScreen();
|
QWidget::showFullScreen();
|
||||||
emit SizeChanged(width(), height());
|
|
||||||
|
const auto dpr =
|
||||||
|
QGuiApplication::screens()[QApplication::desktop()->screenNumber(this)]->devicePixelRatio();
|
||||||
|
|
||||||
|
emit SizeChanged(width() * dpr, height() * dpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderWidget::event(QEvent* event)
|
bool RenderWidget::event(QEvent* event)
|
||||||
|
@ -116,7 +124,11 @@ bool RenderWidget::event(QEvent* event)
|
||||||
{
|
{
|
||||||
const QResizeEvent* se = static_cast<QResizeEvent*>(event);
|
const QResizeEvent* se = static_cast<QResizeEvent*>(event);
|
||||||
QSize new_size = se->size();
|
QSize new_size = se->size();
|
||||||
emit SizeChanged(new_size.width(), new_size.height());
|
|
||||||
|
const auto dpr =
|
||||||
|
QGuiApplication::screens()[QApplication::desktop()->screenNumber(this)]->devicePixelRatio();
|
||||||
|
|
||||||
|
emit SizeChanged(new_size.width() * dpr, new_size.height() * dpr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QEvent::WindowStateChange:
|
case QEvent::WindowStateChange:
|
||||||
|
|
Loading…
Reference in New Issue