Questions tagged [qdatastream]

The QDataStream class provides serialization of binary data to a QIODevice.

The QDataStream class provides serialization of binary data to a QIODevice.

A data stream is a binary stream of encoded information which is 100% independent of the host computer's operating system, CPU or byte order. For example, a data stream that is written by a PC under Windows can be read by a Sun SPARC running Solaris. One can also use a data stream to read/write raw unencoded binary data.

The QDataStream class implements the serialization of C++'s basic data types, like char, short, int, char *, etc. Serialization of more complex data is accomplished by breaking up the data into primitive units.

105 questions
1
vote
2 answers

Unwanted character in CSV file when serializing from QTableWidget

I am trying to read data from a QTableWidget, and save them in a CSV file. The values saved in the file are correct, but for the first column in every row there is an unwanted character in the beginning. Here is my code: void…
Vishal Khemani
  • 171
  • 2
  • 13
1
vote
1 answer

Correct overriding QDataStream operators and linking problems

I need override >> and << operators of QDataStream. There's my code: QDataStream &operator <<(QDataStream &out, const SScenarioEntry Entry) { out.writeRawData(Entry.EntryName, sizeof(Entry.EntryName)); out << Entry.Number; out <<…
1
vote
3 answers

QDatastream too slow?

I am trying to pass multiple images (actually a video) between two processes using QSharedmemory. Currently I am serializing a QVector of QImages and copying this to the memory. This works, but the serialization steps takes about 99% of the time.…
MaxR
  • 11
  • 3
1
vote
1 answer

Why is it possible to write QVariant to QDataStream when QDataStream dosen't have such method?

I can write a QVariant to a QDataStream and read a QVariant from a QDataStream without a problem. QByteArray byteArray; QDataStream outStream(&byteArray, QIODevice::WriteOnly); QVariant outVar(QString("hello")); outStream << outVar; QVariant…
Lahiru Chandima
  • 22,324
  • 22
  • 103
  • 179
1
vote
1 answer

Deserialized map's size increase in qt c++

I have serialized a map using QDataStream and written the object into a file. The serialized file size is 1.5mb when i deserialize it again and load the map into memory, the memory consumption was 300mb. I have used the same QDataStream to…
aditya
  • 21
  • 2
1
vote
1 answer

How to write bytes to a QDataStream in PySide and Python 3.X?

In the Qt documentation of QDataStream it says The QDataStream class provides serialization of binary data to a QIODevice. so that's what I want to do. I want to send bytes in PySide on Python 3.X to a QDataStream. writeRawData however expects…
NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
1
vote
2 answers

Qt - QDataStream with overloaded operator<< for object pointer (Class*)

I am trying to read/write my custom classes using QDataStream. I have overridden the << and >> operators, which seem to work fine for normal objects. However, when I try to pass a pointer to my custom object, the overridden operators don't work…
Elessar
  • 45
  • 1
  • 2
  • 10
0
votes
1 answer

Where can i find how CArchive serialized MFC C++

The point is I am trying to extract this CTime what was compressed with CArchive into QDateTime using QDataStream. I know that it is not the same, but which is why I am trying to read the raw data out. I have no control over no using CTime CArchive,…
0
votes
0 answers

Reading CString from the CArchive datastream into QString (QDataSteam)

I have an issue where I am getting blank when reading data from CString (CArchive) into QString(QDataStream) I am in the process of converting my code from windows Visual Studio into linux QT. However I have a data file that I saved of from the…
0
votes
0 answers

QTCP/IP Reception Issue

I have a QTCPServer receiver that is receiving different streams of data Each QDataStream is received at fixed intervals i.e. 10 Hz and 1Hz Out of all these data streams, two streams are received at same 10Hz rate Issue: Since dataRate is the same…
taimoor1990
  • 158
  • 1
  • 13
0
votes
1 answer

Parse stream in x length chunks based on uint32 id

I have little C/Qt experience and have a small parser that I need to port to Python. Is anyone able to explain how I can implement the below in Python? I understand what the result is, just can't understand how to achieve the uint32 instantiation…
circa
  • 75
  • 8
0
votes
0 answers

Converting littleEndian via QDataStream

i want to send some integers (int32_t) via network. For this I convert the integers first and send them. p.x = 129; p.y = 42; p.d = counter++; converted[0] = htonl(p.x); converted[1] = htonl(p.y); converted[2] = htonl(p.d); if ( (bytes =…
0
votes
1 answer

Can't define friend functions without namespace conflict

I have created a class (MyNodeClass) and now want to add serialization capabilities. I declare (in mynodeclass.h) my serialization methods as follows: #ifndef MYNODECLASS_H #define MYNODECLASS_H #include #include #include…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
0 answers

Serialize / Deserialize QVariantMap with QDataStream between PyQt >> Qt-C++

I can Successfully Serialize / Deserialize QVariantMap through QDataStream in the PyQt5 Python : data = {'mq_username': ('123'), 'np_database': ('png') , 'category': ('png') , 'enroll_name': ('png') , 'notes': ('png') , 'file': ('png') , …
Prometheus
  • 105
  • 1
  • 2
  • 8
0
votes
1 answer

QDataStream readQString() How to read utf8 String

I am trying to decode UDP packet data from an application which encoded the data using Qt's QDataStream methods, but having trouble when trying to decode string fields. The docs say the data was encoded in utf8. The python QDataStream module only…