diff options
author | Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> | 2009-07-16 18:20:03 +0200 |
---|---|---|
committer | Kavindra Devi Palaraja <kavindra.palaraja@nokia.com> | 2009-07-16 18:55:29 +0200 |
commit | 9131bf7f12292da68b5eba29d1ec10c5f68a1e5c (patch) | |
tree | 86c664cf29cea892581ece0ef50426c61bec230f /doc/addressbook-sdk.qdoc | |
parent | 470517415f92ea4a05c81e053bbc88ea057d64b6 (diff) | |
download | qt-creator-9131bf7f12292da68b5eba29d1ec10c5f68a1e5c.tar.gz |
Doc - Modifying Part 2 to use ui->element instead of copy the ui's
element all over the code
Reviewed-By: TrustMe
Diffstat (limited to 'doc/addressbook-sdk.qdoc')
-rw-r--r-- | doc/addressbook-sdk.qdoc | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc index 259512694f..f8fbc4c0fd 100644 --- a/doc/addressbook-sdk.qdoc +++ b/doc/addressbook-sdk.qdoc @@ -310,27 +310,17 @@ \snippet examples/addressbook-sdk/part2/addressbook.h slot definition - Next, we have to provide private members for the \c AddressBook class so - that we can access these widgets freely throughout the class. - - \snippet examples/addressbook-sdk/part2/addressbook.h members1 - - The Qt types used for our private members, e.g., QPushButton, QLineEdit, - QTextEdit, etc., need to be included with the \c include directive, as - shown below: + Since the \c AddressBook class is a subclass of QWidget, Qt Creator + includes QWidget in the hedaer file. \snippet examples/addressbook-sdk/part2/addressbook.h include - \note The names, e.g., \c addButton etc., correspond to the name of the - actual object. You can modify them by double-clicking on their names within - \QD's \gui{Object Inspector}. - We need a container to store our address book contacts, so that we can traverse and display them. A QMap object, \c contacts, is used for this purpose as it holds a key-value pair: the contact's name as the \e key, and the contact's address as the \e value. - \snippet examples/addressbook-sdk/part2/addressbook.h members2 + \snippet examples/addressbook-sdk/part2/addressbook.h members We also declare two private QString objects, \c oldName and \c oldAddress. These objects are needed to hold the name and address of hte contact that @@ -339,16 +329,15 @@ contact. Let's move on to implementing the slots we defined earlier. Within the - constructor of \c AddressBook, we extract the widgets from the form using - the \c ui object by pointing our private members to them. + constructor of \c AddressBook, we set up our fields by ensuring that + \c nameLine and \c addressText are read-only, so that we can only display + but not edit existing contact details. - \snippet examples/addressbook-sdk/part2/addressbook.cpp extract objects + \snippet examples/addressbook-sdk/part2/addressbook.cpp setup fields - Then we set \c nameLine and \c addressText to read-only, so that we can - only display but not edit existing contact details. We also hide - \c submitButton and \c cancelButton as they will only be be displayed - when the user clicks \gui Add, and this is handled by the \c addContact() - function discussed below. + We also hide both \c submitButton and \c cancelButton as they will only be + displayed when the user clicks \gui Add, and this is handled by the + \c addContact() function discussed below. \snippet examples/addressbook-sdk/part2/addressbook.cpp signal slot |