diff options
Diffstat (limited to 'doc/src/snippets/code/doc_src_q3dict.qdoc')
-rw-r--r-- | doc/src/snippets/code/doc_src_q3dict.qdoc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/src/snippets/code/doc_src_q3dict.qdoc b/doc/src/snippets/code/doc_src_q3dict.qdoc new file mode 100644 index 0000000..f79d0f7 --- /dev/null +++ b/doc/src/snippets/code/doc_src_q3dict.qdoc @@ -0,0 +1,29 @@ +//! [0] +Q3Dict<char> dict; + ... +if ( dict.find( key ) ) + dict.remove( key ); +dict.insert( key, item ); +//! [0] + + +//! [1] +Q3Dict<QLineEdit> fields; +fields.insert( "forename", new QLineEdit( this ) ); +fields.insert( "surname", new QLineEdit( this ) ); +fields.insert( "age", new QLineEdit( this ) ); + +fields["forename"]->setText( "Homer" ); +fields["surname"]->setText( "Simpson" ); +fields["age"]->setText( "45" ); + +Q3DictIterator<QLineEdit> it( fields ); +for( ; it.current(); ++it ) + cout << it.currentKey() << ": " << it.current()->text() << endl; +cout << endl; + +// Output (random order): +// age: 45 +// surname: Simpson +// forename: Homer +//! [1] |