c++ - How to pass QDataStream as parameter to signal in Qt5 -
i writing method parse network packet in form of qbytearray
. extract few values using qdatastream
, pass qdatastream
along method further processing (to avoid overhead of making qdatastream
later).
here code:
//datagram qbytearray qdatastream ds=new qdatastream(&datagram, qiodevice::readonly); qint64 somevalue = 0; *ds >> somevalue; emit receivepacket(ds,host, port);
since using signals, passing reference not encouraged , since qdatastream
q_disable_copy
option left pass pointer. if decide pass pointer, how can manage memory? (deleting once) later?
Comments
Post a Comment