diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc index 74e5807901ea590f1fa41360211105f03bca8fb5..3d97237e570b018f46f0a38f5669ae68cd4cb33e 100644 --- a/doc/addressbook-sdk.qdoc +++ b/doc/addressbook-sdk.qdoc @@ -346,12 +346,22 @@ \snippet examples/addressbook-sdk/part2/addressbook.cpp signal slot - We connect the push buttons' \l{QAbstractButton::clicked()}{clicked()} - signal to their respective slots. The figure below illustrates this. + We connect the push buttons' \l{QAbstractButton::}{clicked()} signal to + their respective slots. The figure below illustrates this. #image + Finally, we set the window title to "Simple Address Book" using the + \l{QWidget::}{setWindowTitle()} function. + + \snippet examples/addressbook-sdk/part2/addressbook.cpp window title + \section2 The \c{addContact()} Function + In this function, we begin by storing the last displayed contact details + in \c oldName and \c oldAddress. Then we clear these input fields and turn + off the read-only mode. The focus is set on \c nameLine and we display + \c submitButton and \c cancelButton; but we disable \c addButton. + \snippet examples/addressbook-sdk/part2/addressbook.cpp addContact */ diff --git a/doc/examples/addressbook-sdk/part2/addressbook.cpp b/doc/examples/addressbook-sdk/part2/addressbook.cpp index f4a5ea50ec41a2bd4b292bb49cc1b9a0c6add697..1406c3ca72bce0963de909807417f60ed87af407 100644 --- a/doc/examples/addressbook-sdk/part2/addressbook.cpp +++ b/doc/examples/addressbook-sdk/part2/addressbook.cpp @@ -36,7 +36,9 @@ AddressBook::AddressBook(QWidget *parent) SLOT(cancel())); //! [signal slot] + //! [window title] setWindowTitle(tr("Simple Address Book")); + //! [window title] } AddressBook::~AddressBook() @@ -44,9 +46,24 @@ AddressBook::~AddressBook() delete ui; } +//! [addContact] void AddressBook::addContact() { + oldName = nameLine->text(); + oldAddress = addressTExt->toPlainText(); + + nameLine->clear(); + addressText->clear(); + + nameLine->setReadOnly(false); + nameLine->setFocus(Qt::OtherFocusReason); + addressText->setReadOnly(false); + + addButton->setEnabled(false); + submitButton->show(); + cancelButton->show(); } +//! [addContact] void AddressBook::submitContact() {