Questions tagged [qbytearray]

A QByteArray is a class from the Qt toolkit which provides an array of bytes.

QByteArray is meant to replace char * arrays. It can hold both raw bytes, and 8-bit null-terminated strings. QByteArray is initialized as easy as this:

QByteArray myArray("Hello, world!");

It also makes sure that the string is always null-terminated.

QByteArray supports indexed and iterator-based access, as well as it has methods like append() or prepend(), replace(), and other of the kind.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

267 questions
0
votes
1 answer

Loading an image onto a graphics view from a byte array

I have some problem with loading image data from raw bmp data loaded previously from a big game file. I'm sure the data is OK, as the else branch is not reached, but the image is not shown. Maybe I'm not using loadFromData in a correct way? Anyone…
kosto
  • 84
  • 7
0
votes
1 answer

QByteArray vs unsigned char* speed

I want to know that is there any difference between QByteArray and unsigned char* in speed? I have lots of byte arrays and copy operations in my program, so it's important for me to know if there's any difference or not. Thanks
oMatrix
  • 352
  • 1
  • 4
  • 10
0
votes
2 answers

Memory footprint of 5 byte QByteArray. Is quint64 or QByteArray of 5 bytes more efficient for storage?

Checking size of QByteArray always returns 4 bytes, I'm assuming due to implicit sharing of data in Qt: int n = 50; //or n = 100, 200 QByteArray arr(n,'a'); cout << sizeof(arr) << endl; ::getchar(); Always prints 4 How can I estimate the actual…
Ilya Kobelevskiy
  • 5,245
  • 4
  • 24
  • 41
0
votes
2 answers

QByteArray as blob data inserted partially in sqlite3 (c++)

I am trying to insert an image data which I have downloaded with QNetworkAccessManager as QByteArray. I am trying to insert this QByteArray as BLOB. My table creation query is CREATE TABLE TILE_IMAGE(TILE_ID VARCHAR(1050), IMAGE_DATA…
Tahlil
  • 2,680
  • 6
  • 43
  • 84
0
votes
1 answer

QByteArray remove first 4 lines

I have QByteArray and need to remove first 4 lines. I can do it with regular expressions, for example, but is it some easier way? UPD: first lines(more than 4) in my QByteArray is text, with '\n' in the end.
Borrimoro
  • 529
  • 3
  • 9
  • 19
0
votes
1 answer

QT5 C++ QByteArray XML Parser

I get the following xml Abcdefghij qwertzu
beary
  • 41
  • 2
  • 7
0
votes
1 answer

Send QDataStream through QTcpSocket or QSslSocket

I want to send serialized data through ssl or tcp socket. QIODevice::write doesn't send QDataStream but only char* and QByteArray. Is there a way I can send serialized data through socket? Or how can I convert QDataStream to QByteArray? Thanks
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
0
votes
1 answer

Image width and widthstep, now what?

I have a question dealing with the use of an image's width and widthstep. I have the dimensions as well as the image data as a QByteArray. I also have the widthstep. My question is how to use the widthstep to properly populate the Ipl Image since…
0
votes
3 answers

Qt array QString

I get result from db by selectall query and I want save result in array and send it by socket. db.open(); QSqlQuery *selectall = new QSqlQuery(db); selectall->prepare("select * from phone_table"); selectall->exec(); selectall->first(); QString…
developer
  • 37
  • 1
  • 6
0
votes
1 answer

Qt QTcpSocket QByteArray/QString issues with special characters and proper syntax

I'm having trouble some special characters in Qt, the 2 being the quote and newline. I'm connecting to the server using telnet, and the server automatically puts quotes at the beginning and end of the input for some reason. I'm having trouble…
Knox
  • 1,150
  • 1
  • 14
  • 29
0
votes
3 answers

Convert int to little-endian formated bytes in C++ for blobId in Azure

Working with a base64 encoding for Azure (http://msdn.microsoft.com/en-us/library/dd135726.aspx) and I dont seem to work out how to get the required string back. I'm able to do this in C# where I do the following. int blockId = 5000; var…
chikuba
  • 4,229
  • 6
  • 43
  • 75
-1
votes
1 answer

Convert QByteArray to QString

I want to encrypt the data of a database and to do this, I used AES_128 in this link for encryption. The result of encryption is a QByteArray and the QByteArray is saved on the text file in the correct shape and I could decode it correctly, but and…
Javad_R
  • 1
  • 3
-1
votes
1 answer

QByteArray to short Int array in QT C++

I am receiving a QByteArray from UDP Socket. The QByteArray is of 52 elements each containing values from 0 to 9 - A to F. Now, I want to convert this QByteArray into a short int array of 13 elements such that first 4 elements of the QByteArray are…
-1
votes
1 answer

QByteArray is adding 4 extra bytes when outputting to a file

I am working on OpenRGB's auto Updates but recently it(Qt) started added extra bytes to the raw file I am downloading the file with QByteArray OpenRGBUpdateInfoPage::GetPageSourceOrFile(QString link) { QEventLoop GetPageSourceOrFile; …
1 2 3
17
18