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.

103 questions
0
votes
2 answers

How to send QSqlQueryModel over QTcpSocket with QDatastream?

I want to send QSqlQueryModel to the another client with QDatastream and QTcpSocket. I want to remove some rows and add few extra rows to QSqlQueryModel (without changing the database) and send it to the client like this pseudocode:- QTcpSocket…
0
votes
1 answer

QDataStream not initialized while reading buffer from ipc fifo file descriptor

I want to communicate between two application using fifo (ipc), I have created a fifo by "mkfifo MyPipe" command. first App: .... .... fd = open("MyPipe", O_NONBLOCK | O_WRONLY); QByteArray buf; QDataStream…
Panahi
  • 1
  • 2
0
votes
0 answers

Qt Serialization no match for operator << operand types are 'QDataStream'

I have a problem during serialization with a simple Managed Structure. My Class Header class MappySaver { public: MappySaver(); //structure struct Tile { public: int ID; int x,y,w,h; QRect rect; }; …
0
votes
2 answers

convert from 'const QVector>' to 'QVector>'

How can I solve the following, ie, converting const QVector> to QVector>? I tried a few steps but didn't help: QVector> points = const_cast>>(abc.points); abc.points is a struct…
Sayan Bera
  • 123
  • 12
0
votes
1 answer

QT read/write from QDataStream

I think i am having a fundamental misunderstanding of how all of this works, I am trying to combine 2 hexfiles in my QDataStream and then output them to a new QFile. QFile filea( file1 ); QFile fileb( file2 ); QByteArray ba; QDataStream ds(ba); ds…
0
votes
1 answer

Read binary file created in QT with QDataStream in C#

I'm trying to read an existing file that was created from a QT application using QDataStream, I'm using C# to read it but I can not make work. Here is my C# code for reading the file: I get no errors just a blank MessageBox. How can I read file…
fs_tigre
  • 9,459
  • 12
  • 53
  • 111
0
votes
0 answers

QTcpsocket/QTcpserver transmission, how to use QdataStream to transfer a table data

QTcpsocket/QTcpserver transmission, how to use QdataStream to transfer a table data?? There are ideas: Write data stream on each row and then call write(), but how to write again? Existing issues: Data is garbled, the first line of data is written…
0
votes
0 answers

Qt - Sending a large amount of data via QDataStream TCP

I want to benchmark a TCP Connection to an ECU (Transferrate) For that, i want so send some Data. The amout of data can be set in my GUI from x KB to x GB. The transferSize is calculated from the values set in the GUI. Buffer Size is 1024: #define…
0
votes
0 answers

qt c++ send 6 bytes using tcp protocol

Hi everybody, first of all I'm new on network programming so maybe this is a simple question, but I don't get it. I try to send 6 Bytes to a microcontroller using tcp socket. In order to serialize my data I'm using qdatastream and qbytearray.…
0
votes
1 answer

QDataStream not working as expected

I am storing some data in QDataStream and immediately taking the data, but the count is showing zero while retriving. code looks fine but unexpected behaviour //Overloading QDataStream& operator<< (QDataStream& writeTO, const CascadeJobInfo&…
Sijith
  • 3,122
  • 14
  • 52
  • 86
0
votes
1 answer

Subclassing QIODevice: Wrapper for QUdpSocket

I am trying to implement my own wrapper over QUdpSocket because of it is uncomfortable to use. I can use it, but anyway I need to implement some intermediate buffer for access to QDataStream operations. In additional: I sublass QIODevice, header…
Vladimir Bershov
  • 2,547
  • 1
  • 14
  • 42
0
votes
1 answer

(De)serialization QSet with enum using QDataStream

I use Qt 4.8.7. I have enum Color {red, green, blue} and QSet. How should I (de)serialize QSet using QDataStream? Deserialization fails with custom type. Should I manually create serialization (loop over QSet elements) besides…
ilya
  • 941
  • 10
  • 30
0
votes
1 answer

Read (many) values from QTcpSocket (fast)

I'm using a measurement device which sends (binary) float values using a tcp socket with up to 70 kHz. My goal is to read these values as fast as possible and use them in other parts of my program. Till now I'm able to extract value by value using a…
Famok
  • 3
  • 3
0
votes
1 answer

TGA reading header with QDataStream

I am trying to read a TGA file header with Qt QDataStream. I have the following structure from the specs with fixed types: #pragma pack(push, 1) /* TGA header */ struct tga_header_t { quint8 id_lenght; /* size of image id */ …
2A-66-42
  • 384
  • 3
  • 14
0
votes
1 answer

Serialize shape to save and re-draw

I have a QGraphicsScene where I am drawing a QPainterPath, and I need to be able to save the shape, and redraw it when the app runs again. Here is how I'm drawing the shape, simplified version, and my write method. void drawPath(){ QPoint p1 =…
bauervision
  • 585
  • 1
  • 6
  • 21