Compatibility Members for QByteArray

The following members of class QByteArrayare part of the Qt compatibility layer. We advise against using them in new code.

Public Functions

QByteArray(int size)
QByteArray & duplicate(const QByteArray & a)
QByteArray & duplicate(const char * a, uint n)
int find(char c, int from = 0) const
int find(const char * c, int from = 0) const
int find(const QByteArray & ba, int from = 0) const
int find(const QString & s, int from = 0) const
int findRev(char c, int from = -1) const
int findRev(const char * c, int from = -1) const
int findRev(const QByteArray & ba, int from = -1) const
int findRev(const QString & s, int from = -1) const
QByteArray leftJustify(uint width, char fill = ' ', bool truncate = false) const
QByteArray lower() const
void resetRawData(const char * data, uint n)
QByteArray rightJustify(uint width, char fill = ' ', bool truncate = false) const
QByteArray simplifyWhiteSpace() const
QByteArray stripWhiteSpace() const
QByteArray upper() const

Member Function Documentation

QByteArray::QByteArray(int size)

Use QByteArray(int, char) instead.

QByteArray & QByteArray::duplicate(const QByteArray & a)

For example, if you have code like

QByteArray bdata;
bdata.duplicate(original);

you can rewrite it as

QByteArray bdata;
bdata = original;

Note: QByteArray uses implicit sharing so if you modify a copy, only the copy is changed.

QByteArray & QByteArray::duplicate(const char * a, uint n)

This is an overloaded function.

For example, if you have code like

QByteArray bdata;
bdata.duplicate(ptr, size);

you can rewrite it as

QByteArray bdata;
bdata = QByteArray(ptr, size);

Note: QByteArray uses implicit sharing so if you modify a copy, only the copy is changed.

int QByteArray::find(char c, int from = 0) const

Use indexOf() instead.

int QByteArray::find(const char * c, int from = 0) const

Use indexOf() instead.

int QByteArray::find(const QByteArray & ba, int from = 0) const

Use indexOf() instead.

int QByteArray::find(const QString & s, int from = 0) const

Use indexOf() instead.

int QByteArray::findRev(char c, int from = -1) const

Use lastIndexOf() instead.

int QByteArray::findRev(const char * c, int from = -1) const

Use lastIndexOf() instead.

int QByteArray::findRev(const QByteArray & ba, int from = -1) const

Use lastIndexOf() instead.

int QByteArray::findRev(const QString & s, int from = -1) const

Use lastIndexOf() instead.

QByteArray QByteArray::leftJustify(uint width, char fill = ' ', bool truncate = false) const

Use leftJustified() instead.

QByteArray QByteArray::lower() const

Use toLower() instead.

void QByteArray::resetRawData(const char * data, uint n)

Use clear() instead.

QByteArray QByteArray::rightJustify(uint width, char fill = ' ', bool truncate = false) const

Use rightJustified() instead.

QByteArray QByteArray::simplifyWhiteSpace() const

Use simplified() instead.

QByteArray QByteArray::stripWhiteSpace() const

Use trimmed() instead.

QByteArray QByteArray::upper() const

Use toUpper() instead.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.