How to use the Qt Class Library
This article mainly explains "how to use the Qt class library". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use the Qt class library.
Function name / / int transbyte array static QByteArray intToByte (int I); static QByteArray intToByteRec (int I); / / byte array to int static int byteToInt (const QByteArray & data); static int byteToIntRec (const QByteArray & data); static quint32 byteToUInt (const QByteArray & data); static quint32 byteToUIntRec (const QByteArray & data); / / ushort transbyte array static QByteArray ushortToByte (ushort I); static QByteArray ushortToByteRec (ushort I) / / Byte array to ushort static int byteToUShort (const QByteArray & data); static int byteToUShortRec (const QByteArray & data); function body QByteArray QUIHelper::intToByte (int I) {QByteArray result; result.resize (4); result [3] = (uchar) (0x000000ff & I); result [2] = (uchar) ((0x0000ff00 & I) > 8); result [1] = (uchar) ((0x00ff0000 & I) > > 16) Result [0] = (uchar) ((0xff000000 & I) > 24); return result;} QByteArray QUIHelper::intToByteRec (int I) {QByteArray result; result.resize (4); result [0] = (uchar) (0x000000ff & I); result [1] = (uchar) ((0x0000ff00 & I) > 8); result [2] = (uchar) ((0x00ff0000 & I) > 16); result [3] = (uchar) ((0xff000000 & I) > > 24); } int QUIHelper::byteToInt (const QByteArray & data) {int I = data.at (3) & 0x000000ff; I | = (data.at (2)