Commit e94cefc6 authored by Kavindra Devi Palaraja's avatar Kavindra Devi Palaraja Committed by con
Browse files

Fixes: Doc - more of the tutorial, part 2

RevBy:    TrustMe
parent c9a00bff
...@@ -346,12 +346,22 @@ ...@@ -346,12 +346,22 @@
\snippet examples/addressbook-sdk/part2/addressbook.cpp signal slot \snippet examples/addressbook-sdk/part2/addressbook.cpp signal slot
We connect the push buttons' \l{QAbstractButton::clicked()}{clicked()} We connect the push buttons' \l{QAbstractButton::}{clicked()} signal to
signal to their respective slots. The figure below illustrates this. their respective slots. The figure below illustrates this.
#image #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 \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
*/ */
...@@ -36,7 +36,9 @@ AddressBook::AddressBook(QWidget *parent) ...@@ -36,7 +36,9 @@ AddressBook::AddressBook(QWidget *parent)
SLOT(cancel())); SLOT(cancel()));
//! [signal slot] //! [signal slot]
//! [window title]
setWindowTitle(tr("Simple Address Book")); setWindowTitle(tr("Simple Address Book"));
//! [window title]
} }
AddressBook::~AddressBook() AddressBook::~AddressBook()
...@@ -44,9 +46,24 @@ AddressBook::~AddressBook() ...@@ -44,9 +46,24 @@ AddressBook::~AddressBook()
delete ui; delete ui;
} }
//! [addContact]
void AddressBook::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() void AddressBook::submitContact()
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment