Commit 3415bd20 authored by Antenore Gatta's avatar Antenore Gatta Committed by Albert Astals Cid
Browse files

Replace functions deprecated in Qt 5.15

This patch replaces:

* vsprintf with vasprintf.
* functions like `QApplication::desktop()->screenGeometry()`

I've done some tests, and it seems to work properly.

As mentioned at #4 (comment 433301) there are some use cases that need attention, but it shouldn't be done in the scope of this MR as the problem exists as well with the deprecated functions.
parent d3d5621e
Pipeline #165264 passed with stage
in 1 minute and 12 seconds
......@@ -36,6 +36,7 @@
#include <QDockWidget>
#include <QFontMetrics>
#include <QGroupBox>
#include <QGuiApplication>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QIcon>
......@@ -349,11 +350,10 @@ void MainWindow::resizeTabWidget(int w, int h)
}
const QSize viewSize = QSize(w,h);
QDesktopWidget *desktop = QApplication::desktop();
QScreen *currentScreen = QGuiApplication::screenAt(geometry().center());
if (Settings::fullscreenOnConnect()) {
int currentScreen = desktop->screenNumber(this);
const QSize screenSize = desktop->screenGeometry(currentScreen).size();
const QSize screenSize = currentScreen->availableGeometry().size();
if (screenSize == viewSize) {
qCDebug(KRDC) << "screen size equal to target view size -> switch to fullscreen mode";
......@@ -366,7 +366,7 @@ void MainWindow::resizeTabWidget(int w, int h)
QWidget* currentWidget = m_tabWidget->currentWidget();
const QSize newWindowSize = size() - currentWidget->frameSize() + viewSize;
const QSize desktopSize = desktop->availableGeometry().size();
const QSize desktopSize = currentScreen->availableGeometry().size();
qCDebug(KRDC) << "new window size: " << newWindowSize << " available space:" << desktopSize;
if ((newWindowSize.width() >= desktopSize.width()) || (newWindowSize.height() >= desktopSize.height())) {
......
......@@ -126,6 +126,7 @@ Q_SIGNALS:
#include <QApplication>
#include <QDesktopWidget>
#include <QMouseEvent>
#include <QScreen>
class MinimizePixel : public QWidget
{
......@@ -134,7 +135,7 @@ public:
explicit MinimizePixel(QWidget *parent)
: QWidget(parent) {
setFixedSize(1, 1);
move(QApplication::desktop()->screenGeometry().width() - 1, 0);
move(QGuiApplication::screenAt(geometry().center())->geometry().width() - 1, 0);
}
Q_SIGNALS:
......
......@@ -305,7 +305,7 @@ rfbCredential *VncClientThread::credentialHandler(int credentialType)
void VncClientThread::outputHandler(const char *format, va_list args)
{
QString message;
message.vsprintf(format, args);
message.vasprintf(format, args);
message = message.trimmed();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment