aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/doc_src_q3dict.qdoc
blob: f79d0f7396d21be6dd22080dd9f7ecb7299da8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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]