diff options
Diffstat (limited to 'doc/src/snippets')
-rw-r--r-- | doc/src/snippets/audio/main.cpp | 4 | ||||
-rw-r--r-- | doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp | 1 | ||||
-rw-r--r-- | doc/src/snippets/code/src_corelib_tools_qbytearray.cpp | 17 |
3 files changed, 20 insertions, 2 deletions
diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index 019f208..f000075 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -89,9 +89,9 @@ private: { //![1] QAudioFormat format; - format.setFrequency(44100); + format.setSampleRate(44100); //![1] - format.setChannels(2); + format.setChannelCount(2); format.setSampleSize(16); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); diff --git a/doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp b/doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp index 99fd0cf..bcb61f7 100644 --- a/doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp +++ b/doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp @@ -62,6 +62,7 @@ while (new_data_available()) { QByteArray chunk = get_new_data(); string += decoder->toUnicode(chunk); } +delete decoder; //! [2] diff --git a/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp b/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp index 736394f..3cd3db8 100644 --- a/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/doc/src/snippets/code/src_corelib_tools_qbytearray.cpp @@ -401,5 +401,22 @@ QByteArray text = QByteArray::fromHex("517420697320677265617421"); text.data(); // returns "Qt is great!" //! [45] +//! [46] +QString tmp = "test"; +QByteArray text = tmp.toLocal8Bit(); +char *data = new char[text.size()] +strcpy(data, text.data()); +delete [] data; +//! [46] + +//! [47] +QString tmp = "test"; +QByteArray text = tmp.toLocal8Bit(); +char *data = new char[text.size() + 1] +strcpy(data, text.data()); +delete [] data; +//! [47] + } + |