summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/addressbook-sdk.qdoc35
-rw-r--r--doc/examples/addressbook-sdk/part2/addressbook.cpp1
2 files changed, 25 insertions, 11 deletions
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc
index fedefdcc96..1b77d98282 100644
--- a/doc/addressbook-sdk.qdoc
+++ b/doc/addressbook-sdk.qdoc
@@ -164,10 +164,11 @@
Next, we have to position the widgets properly, according to the screenshot
earlier. We use a QGridLayout to position our labels and input fields in a
structured manner. QGridLayout divides the available space into a grid and
- places widgets in the cells we specify with row and column numbers. The
- diagram below shows the layout cells and the position of our widgets. Place
- your widgets accordingly and save the form by choosing \gui{File -> Save}
- or using the \key{Ctrl+S} shortcut.
+ places widgets in the cells we specify with row and column numbers. To place
+ the caption of the \c addressLabel on the top, change the vertical alignment
+ property to \c AlignTop. The diagram below shows the layout cells and the
+ position of our widgets. Place your widgets accordingly and save the form by
+ choosing \gui{File -> Save} or using the \key{Ctrl+S} shortcut.
\image addressbook-tutorial-part1-labeled-screenshot.png
@@ -294,8 +295,12 @@
layouts: select \gui{Break Layout} from the context menu. You might have to
do a \gui{Select All} with \key{Ctrl+A} first.. Then, we add three push
buttons. Double-click on each of them to set their text to "Add", "Submit",
- and "Cancel". We now require a vertical spacer to ensure that the push
- buttons will be laid out neatly; drag one from the \gui{Widget Box}.
+ and "Cancel". Next, set the \c objectName of the buttons to \c addButton,
+ \c submitButton and \c cancelButton respectively.
+ We now require a vertical spacer to ensure that the push buttons will be laid
+ out neatly; drag one from the \gui{Widget Box}.
+
+ ## image for button missing
Next, lay out these three push buttons and the spacer vertically, by
selecting all three of them (using the \key{Ctrl + click}) and choosing
@@ -331,7 +336,10 @@
\snippet examples/addressbook-sdk/part2/addressbook.h slot definition
Since the \c AddressBook class is a subclass of QWidget, Qt Creator
- includes QWidget in the hedaer file.
+ includes QWidget in the header file.
+
+ ## this is a bit confusing, because QWidget is already included, but without QtGui/
+ ## Also, how about ordering the includes by module?
\snippet examples/addressbook-sdk/part2/addressbook.h include
@@ -348,10 +356,14 @@
clicks \gui Cancel, we can revert to displaying the details of the last
contact.
+ ## this is a bit confusing, as the ctor was not defined by us nor is a slot
+
Let's move on to implementing the slots we defined earlier. Within the
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.
+ but not edit existing contact details. Note that in order to prevent
+ crashes, you need make sure that the autogenerated \c setupUi() call
+ is always first in the constructor.
\snippet examples/addressbook-sdk/part2/addressbook.cpp setup fields
@@ -367,7 +379,8 @@
\image addressbook-tutorial-part2-signals-and-slots.png
Finally, we set the window title to "Simple Address Book" using the
- \l{QWidget::}{setWindowTitle()} function.
+ \l{QWidget::}{setWindowTitle()} function. The tr() method allows us
+ to translate user interface strings. Refer to ###.
\snippet examples/addressbook-sdk/part2/addressbook.cpp window title
@@ -474,7 +487,7 @@
below illustrates what you will see as the button layout approaches the
grid layout; drop it then.
- \image addressbook-tutorial-part3-drop-in-gridlayout
+ \image addressbook-tutorial-part3-drop-in-gridlayout.png
Finally, set a top level layout for the widget again.
@@ -495,6 +508,8 @@
default. This is because navigation is only enabled when there is more than
one contact in the address book.
+ \snippet examples/addressbook-sdk/part3/addressbook.cpp setup fields
+
Next, we connect the buttons to their respective slots:
\snippet examples/addressbook-sdk/part3/addressbook.cpp signal slot
diff --git a/doc/examples/addressbook-sdk/part2/addressbook.cpp b/doc/examples/addressbook-sdk/part2/addressbook.cpp
index 0e47c9002b..b70f7d7fc4 100644
--- a/doc/examples/addressbook-sdk/part2/addressbook.cpp
+++ b/doc/examples/addressbook-sdk/part2/addressbook.cpp
@@ -69,7 +69,6 @@ void AddressBook::submitContact()
contacts.insert(name, address);
QMessageBox::information(this, tr("Add Successful"),
tr("\"%1\" has been added to your address book.").arg(name));
- return;
} else {
QMessageBox::information(this, tr("Add Unsuccessful"),
tr("Sorry, \"%1\" is already in your address book.").arg(name));