diff options
| author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-03 14:05:01 (GMT) |
|---|---|---|
| committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-03 14:05:01 (GMT) |
| commit | 618d89d65e367521552e6d6f50b5aa5e04e72025 (patch) | |
| tree | 57cdac591c8c1430e3fe5f4135a48acb5ae3de05 /doc/src/snippets/code/doc_src_q3memarray.qdoc | |
| parent | 607c58619ffd29d76a640d73d757ac062d45a492 (diff) | |
| parent | fffb6f200785a9e85d56431f598046bb6b5d493b (diff) | |
| download | Qt-618d89d65e367521552e6d6f50b5aa5e04e72025.zip Qt-618d89d65e367521552e6d6f50b5aa5e04e72025.tar.gz Qt-618d89d65e367521552e6d6f50b5aa5e04e72025.tar.bz2 | |
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (237 commits)
Fix animation tests after merge
Remove duplicated test.
Add missing test file.
Changing width of RTL positioner doesn't relayout
Fix TextInput auto test failure on mac.
PinchArea and Flickable don't work well enough together
Do not set focus unnecessarily at window activation in Symbian
QS60Style: Regression in drawing dialog background
QS60Style: Support menu separator (pt.2)
Fix auto test failure.
Support for new softkey in Symbian^3
Once Image sourceSize is set there is no way to clear it.
Rotation transform with NaN angle can cause crash
QSoftkeyManager auto test update
Fixed not switching to MeeGo graphicssystem.
Canceling image download while reading causes crash
Fix width of TextInput micro focus rectangle.
Return correct boundaries reasons from QTextBoundaryFinder.
GridView jumps to beginning of list when resized
Fixed rounding of coordinates pre-transformation in CG paintengine.
...
Diffstat (limited to 'doc/src/snippets/code/doc_src_q3memarray.qdoc')
| -rw-r--r-- | doc/src/snippets/code/doc_src_q3memarray.qdoc | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/doc/src/snippets/code/doc_src_q3memarray.qdoc b/doc/src/snippets/code/doc_src_q3memarray.qdoc index 8e5e008..a966e50 100644 --- a/doc/src/snippets/code/doc_src_q3memarray.qdoc +++ b/doc/src/snippets/code/doc_src_q3memarray.qdoc @@ -38,36 +38,6 @@ ** ****************************************************************************/ -//! [0] -#include <q3memarray.h> -#include <stdio.h> - -Q3MemArray<int> fib( int num ) // returns fibonacci array -{ - Q_ASSERT( num > 2 ); - Q3MemArray<int> f( num ); // array of ints - - f[0] = f[1] = 1; - for ( int i = 2; i < num; i++ ) - f[i] = f[i-1] + f[i-2]; - - return f; -} - -int main() -{ - Q3MemArray<int> a = fib( 6 ); // get first 6 fibonaccis - for ( int i = 0; i < a.size(); i++ ) - qDebug( "%d: %d", i, a[i] ); - - qDebug( "1 is found %d times", a.contains(1) ); - qDebug( "5 is found at index %d", a.find(5) ); - - return 0; -} -//! [0] - - //! [1] 0: 1 1: 1 @@ -78,43 +48,3 @@ int main() 1 is found 2 times 5 is found at index 4 //! [1] - - -//! [2] -// MyStruct may be padded to 4 or 8 bytes -struct MyStruct -{ - short i; // 2 bytes - char c; // 1 byte -}; - -Q3MemArray<MyStruct> a(1); -a[0].i = 5; -a[0].c = 't'; - -MyStruct x; -x.i = '5'; -x.c = 't'; -int i = a.find( x ); // may return -1 if the pad bytes differ -//! [2] - - -//! [3] -static char bindata[] = { 231, 1, 44, ... }; -QByteArray a; -a.setRawData( bindata, sizeof(bindata) ); // a points to bindata -QDataStream s( a, IO_ReadOnly ); // open on a's data -s >> <something>; // read raw bindata -a.resetRawData( bindata, sizeof(bindata) ); // finished -//! [3] - - -//! [4] -static char bindata[] = { 231, 1, 44, ... }; -QByteArray a, b; -a.setRawData( bindata, sizeof(bindata) ); // a points to bindata -a.resize( 8 ); // will crash -b = a; // will crash -a[2] = 123; // might crash -// forget to resetRawData: will crash -//! [4] |
