From 3464e1e5c7b5b01ae13c99e3529dd02af1d36958 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Wed, 5 Dec 2018 19:48:05 +0000 Subject: Add a few qAsConst() to range-for to prevent detachments places indicated by clazy As a drive-by, fixed minor styling issues in the affected lines. Change-Id: I88d3fc0c8573cde0e61f19a18dd9ea697ee40c34 Reviewed-by: Thiago Macieira Reviewed-by: Luca Beldi Reviewed-by: Friedemann Kleint --- src/plugins/platforms/vnc/qvnc.cpp | 10 ++++------ src/plugins/platforms/vnc/qvncscreen.cpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/vnc') diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp index ffe00de2b1..32114c6443 100644 --- a/src/plugins/platforms/vnc/qvnc.cpp +++ b/src/plugins/platforms/vnc/qvnc.cpp @@ -600,7 +600,7 @@ void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window) cursor = *platformImage.image(); hotspot = platformImage.hotspot(); } - for (auto client : clients) + for (auto client : qAsConst(clients)) client->setDirtyCursor(); } @@ -638,16 +638,14 @@ void QVncServer::init() QVncServer::~QVncServer() { - for (auto client : clients) { - delete client; - } + qDeleteAll(clients); } void QVncServer::setDirty() { - for (auto client : clients) { + for (auto client : qAsConst(clients)) client->setDirty(qvnc_screen->dirtyRegion); - } + qvnc_screen->clearDirty(); } diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp index 67d33de2f0..2eca18fb4d 100644 --- a/src/plugins/platforms/vnc/qvncscreen.cpp +++ b/src/plugins/platforms/vnc/qvncscreen.cpp @@ -75,7 +75,7 @@ bool QVncScreen::initialize() mDepth = 32; mPhysicalSize = QSizeF(mGeometry.width()/96.*25.4, mGeometry.height()/96.*25.4); - for (const QString &arg : mArgs) { + for (const QString &arg : qAsConst(mArgs)) { QRegularExpressionMatch match; if (arg.contains(mmSizeRx, &match)) { mPhysicalSize = QSizeF(match.captured("width").toDouble(), match.captured("height").toDouble()); -- cgit v1.2.3 From 41e7b71c410b77a81d09d3cc2e169ffd7975b4d2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 12 Mar 2019 11:46:26 +0100 Subject: More nullptr usage in headers Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint Reviewed-by: Simon Hausmann --- src/plugins/platforms/vnc/qvnc_p.h | 2 +- src/plugins/platforms/vnc/qvncscreen.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/vnc') diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h index 338fae9f87..f7f2f74ddb 100644 --- a/src/plugins/platforms/vnc/qvnc_p.h +++ b/src/plugins/platforms/vnc/qvnc_p.h @@ -139,7 +139,7 @@ public: class QRfbServerInit { public: - QRfbServerInit() { name = 0; } + QRfbServerInit() { name = nullptr; } ~QRfbServerInit() { delete[] name; } int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); } diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h index e69aa90d41..db658d4ecc 100644 --- a/src/plugins/platforms/vnc/qvncscreen.h +++ b/src/plugins/platforms/vnc/qvncscreen.h @@ -82,12 +82,12 @@ public: qreal dpiX = 96; qreal dpiY = 96; - QVncDirtyMap *dirty = 0; + QVncDirtyMap *dirty = nullptr; QRegion dirtyRegion; int refreshRate = 30; - QVncServer *vncServer = 0; + QVncServer *vncServer = nullptr; #if QT_CONFIG(cursor) - QVncClientCursor *clientCursor = 0; + QVncClientCursor *clientCursor = nullptr; #endif }; -- cgit v1.2.3 From 01e1df90a7debd333314720fdd5cf6cd9964d796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 14 Mar 2019 00:36:34 +0100 Subject: Move screen maintenance functions from QPlatformIntegration to QWSI QWindowSystemInterface is the de facto API for any plumbing going from the platform plugin to QtGui. Having the functions as protected members of QPlatformIntegration was idiosyncratic, and resulted in awkward workarounds to be able to call the functions from outside of the QPlatformIntegration subclass. The functions in QPlatformIntegration have been left in, but deprecated so that platform plugins outside of qtbase have a chance to move over to the new QWSI API before they are removed. Change-Id: I327fec460db6b0faaf0ae2a151c20aa30dbe7182 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/vnc/qvncintegration.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/vnc') diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 1e2cf6292c..c7a796464a 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -77,13 +78,13 @@ QVncIntegration::QVncIntegration(const QStringList ¶mList) QVncIntegration::~QVncIntegration() { delete m_server; - destroyScreen(m_primaryScreen); + QWindowSystemInterface::handleScreenRemoved(m_primaryScreen); } void QVncIntegration::initialize() { if (m_primaryScreen->initialize()) - screenAdded(m_primaryScreen); + QWindowSystemInterface::handleScreenAdded(m_primaryScreen); else qWarning("vnc: Failed to initialize screen"); -- cgit v1.2.3