0

I'm pretty new to Qt and C++.

I've been trying to send a QMouseEvent across a QTcpSocket. I understand that you can serialize QObjects using the QDataStream and the << / >> operators. However, QEvent is not a supported class, so I was wondering if anyone had experience serializing it? As far as I can tell, you can overload the << / >> operators to serialize custom classes but only by breaking them down into supported QObjects, which is not possible in my case since I'm trying to send a base Qt class that simply isn't implemented.

Would it be necessary to use some other library to do this? Or is it possible in QT alone?

  • 1
    This sound like an [xy-problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Why do you want to send a `QEvent` over a tcp connection? Can you provide more context as to what you are trying to do? – G.M. May 01 '20 at 08:57
  • Sorry, you are absolutely correct. I was trying to send a mouse event over a connection, so that a QGraphicsView would be able to respond to a mouse click on either end of the connection. Your comment has made me realise I could just get the local pos info from the event and send _that_ instead, then manually recreate the event on the other side. Although I'm still curious about if there is a solution to being able to send events over a connection. – not_only_but_also May 02 '20 at 03:15

0 Answers0