Obsolete Members for QByteArray

以下成员源于类 QByteArray 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(obsolete) operator const char * () const
(obsolete) operator const void * () const

成员函数文档编制

QByteArray:: operator const char * () const

Returns a pointer to the data stored in the byte array. The pointer can be used to access the bytes that compose the array. The data is '\0'-terminated. The pointer remains valid as long as the array isn't reallocated or destroyed.

This operator is mostly useful to pass a byte array to a function that accepts a const char * .

可以禁用此运算符通过定义 QT_NO_CAST_FROM_BYTEARRAY 当编译应用程序时。

注意: QByteArray 可以存储任何字节值 (包括 \0),但大多数函数需要 char * 自变量,假定数据在遇到首个 \0 时结束。

另请参阅 constData ().

QByteArray:: operator const void * () const

Returns a pointer to the data stored in the byte array. The pointer can be used to access the bytes that compose the array. The data is '\0'-terminated. The pointer remains valid as long as the array isn't reallocated or destroyed.

This operator is mostly useful to pass a byte array to a function that accepts a const char * .

可以禁用此运算符通过定义 QT_NO_CAST_FROM_BYTEARRAY 当编译应用程序时。

注意: QByteArray 可以存储任何字节值 (包括 \0),但大多数函数需要 char * 自变量,假定数据在遇到首个 \0 时结束。

另请参阅 constData ().