Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
ed344241
Commit
ed344241
authored
Jun 08, 2009
by
Kavindra Devi Palaraja
Committed by
con
Jun 09, 2009
Browse files
Doc - fixing up Part 4 and some doc changes
RevBy: TrustMe
parent
1a07f2ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
doc/addressbook-sdk.qdoc
View file @
ed344241
...
...
@@ -696,6 +696,12 @@
in the same function, we avoid the possibility of the user interface
getting "out of sync" with the internal state of the application.
To maintain consistency, we need to modify our \c addContact() and
\c cancel() functions respectively. Below is the code:
\snippet examples/addressbook-sdk/part4/addressbook.cpp addContact
\dots
\snippet examples/addressbook-sdk/part4/addressbook.cpp cancel
*/
/*!
...
...
doc/examples/addressbook-sdk/part4/addressbook.cpp
View file @
ed344241
...
...
@@ -68,6 +68,7 @@ AddressBook::~AddressBook()
delete
ui
;
}
//! [addContact]
void
AddressBook
::
addContact
()
{
oldName
=
nameLine
->
text
();
...
...
@@ -76,16 +77,9 @@ void AddressBook::addContact()
nameLine
->
clear
();
addressText
->
clear
();
nameLine
->
setReadOnly
(
false
);
nameLine
->
setFocus
(
Qt
::
OtherFocusReason
);
addressText
->
setReadOnly
(
false
);
addButton
->
setEnabled
(
false
);
nextButton
->
setEnabled
(
false
);
previousButton
->
setEnabled
(
false
);
submitButton
->
show
();
cancelButton
->
show
();
updateInterface
(
AddingMode
);
}
//! [addContact]
//! [submitContact part1]
void
AddressBook
::
submitContact
()
...
...
@@ -130,28 +124,20 @@ void AddressBook::submitContact()
tr
(
"
\"
%1
\"
has been edited in your address book."
).
arg
(
name
));
contacts
[
name
]
=
address
;
}
updateInterface
(
NavigationMode
);
}
updateInterface
(
NavigationMode
);
}
//! [submitContact part3]
//! [cancel]
void
AddressBook
::
cancel
()
{
nameLine
->
setText
(
oldName
);
nameLine
->
setReadOnly
(
true
);
addressText
->
setText
(
oldAddress
);
addressText
->
setReadOnly
(
true
);
addButton
->
setEnabled
(
true
);
int
number
=
contacts
.
size
();
nextButton
->
setEnabled
(
number
>
1
);
previousButton
->
setEnabled
(
number
>
1
);
submitButton
->
hide
();
cancelButton
->
hide
();
updateInterface
(
NavigationMode
);
}
//! [cancel]
void
AddressBook
::
next
()
{
...
...
@@ -233,7 +219,7 @@ void AddressBook::updateInterface(Mode mode)
nameLine
->
setReadOnly
(
false
);
nameLine
->
setFocus
(
Qt
::
OtherFocusReason
);
addressT
E
xt
->
setReadOnly
(
false
);
addressT
e
xt
->
setReadOnly
(
false
);
addButton
->
setEnabled
(
false
);
editButton
->
setEnabled
(
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment