summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-01-11 13:27:51 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-01-11 13:27:51 (GMT)
commit7f83a227ddfb22a373065c68e903b49ca590cef6 (patch)
tree7063a643d519d91c5e52d4adfa43579e787c3ca5 /doc/src/snippets
parentbbac0f08d65b54eccadae7629a5eef10da3b3370 (diff)
parent22d30bd6c1e8355cb4520885b0d0fef3526cc4e9 (diff)
downloadQt-7f83a227ddfb22a373065c68e903b49ca590cef6.zip
Qt-7f83a227ddfb22a373065c68e903b49ca590cef6.tar.gz
Qt-7f83a227ddfb22a373065c68e903b49ca590cef6.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/audio/main.cpp4
-rw-r--r--doc/src/snippets/code/src_corelib_codecs_qtextcodec.cpp1
-rw-r--r--doc/src/snippets/code/src_corelib_tools_qbytearray.cpp17
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]
+
}
+