Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Using QByteArray: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
m (AutoSpider moved page UsingQByteArray to Using QByteArray: Title formats)
(Add to relevant category)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
[[Category:Developing with Qt]]
 
=== Introduction ===
=== Introduction ===
QByteArray is the Qt class to store a array of bytes. It is analogous to a char *. Unlike a QString, a QByteArray has no encoding information and makes no attempt to decode bytes into characters.
QByteArray is the Qt class to store a array of bytes. It is analogous to a char *. Unlike a QString, a QByteArray has no encoding information and makes no attempt to decode bytes into characters.

Latest revision as of 13:21, 22 November 2016

Introduction

QByteArray is the Qt class to store a array of bytes. It is analogous to a char *. Unlike a QString, a QByteArray has no encoding information and makes no attempt to decode bytes into characters.

Converting QByteArray to QString

To convert a QByteArray to QString, one needs to specify the encoding. It is not possible to convert a QByteArray to QString without knowing the encoding. Once the encoding is known, one can use functions like QString::fromUtf8, QString::fromUcs4 or use QTextCodec::toUnicode().

QByteArray::fromRawData()

No copy. Copies point to raw data.

QByteArray::constData