summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-02 14:18:09 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-02 16:08:57 +0200
commite5a461ac978433a284cc8f4309fdfa326a34a2c0 (patch)
tree90608dbde627ab5c02c7a6840d0bffd2063e0b08 /examples
parentff9d2ee33820a6058186b4d3a55d34515b6d652f (diff)
websockets example: fix namespaced builds
The forward declaration of class QWebSocket in websocketiodevice.h sits at global scope, so declares a second QWebSocket in namespaced builds, and makes the following uses of the name ambiguous. Fix by replacing the forward declaration with an include. This is preferable over QT_FORWARD_DECLARE_CLASS, because ~WebSocketIoDevice() is inline, and QPointer<QWebSocket>::~QPointer() kinda needs to know its payload in-size. The alternative would be to use QT_FORWARD_DECLARE_CLASS and make the destructor out-of-line. This solution is simpler. Amends b8a71125f038b5a52d034b804d32ecddd9e19286. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I8c8dc2a772497c499a708ddb84e7ae6bc56c92bc Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/remoteobjects/websockets/common/websocketiodevice.cpp2
-rw-r--r--examples/remoteobjects/websockets/common/websocketiodevice.h3
2 files changed, 1 insertions, 4 deletions
diff --git a/examples/remoteobjects/websockets/common/websocketiodevice.cpp b/examples/remoteobjects/websockets/common/websocketiodevice.cpp
index 537d9cf..3a9f0de 100644
--- a/examples/remoteobjects/websockets/common/websocketiodevice.cpp
+++ b/examples/remoteobjects/websockets/common/websocketiodevice.cpp
@@ -3,8 +3,6 @@
#include "websocketiodevice.h"
-#include <QWebSocket>
-
WebSocketIoDevice::WebSocketIoDevice(QWebSocket *webSocket, QObject *parent)
: QIODevice(parent)
, m_socket(webSocket)
diff --git a/examples/remoteobjects/websockets/common/websocketiodevice.h b/examples/remoteobjects/websockets/common/websocketiodevice.h
index 433c5cf..8bccf0e 100644
--- a/examples/remoteobjects/websockets/common/websocketiodevice.h
+++ b/examples/remoteobjects/websockets/common/websocketiodevice.h
@@ -7,8 +7,7 @@
#include <QBuffer>
#include <QIODevice>
#include <QPointer>
-
-class QWebSocket;
+#include <QWebSocket>
class WebSocketIoDevice : public QIODevice
{