Suggestion to improve tutorial
-
Hi all, when doing the (very helpful!) AddressBook-tutorial, I stumbled upon some inaccurate code in part 5... see "this StackOverflow-Post":http://stackoverflow.com/questions/23195712/memory-management-in-qt-addressbook-tutorial. Maybe it should be fixed, so there won't be the same confusion for others.
I suggest just changing
@AddressBook::AddressBook(QWidget *parent) : QWidget(parent)
{
dialog = new FindDialog;
}@to
@AddressBook::AddressBook(QWidget *parent) : QWidget(parent)
{
dialog = new FindDialog(this);
}@this would make it clear, that the dialog is a child object of AddressBook and thus will be deleted correctly.
The QPointer solution would be more thorough, but also a lot more confusing for beginners.
Happy to hear your thoughts on this!
-
Hi Alex,
Good suggestion,
If you like, you can contribute this change trough codereview.qt-project.org!
-
Hi, and welcome to the Qt Dev Net!
Thanks for reporting this, Alex. I've taken note of it, and will update it for the Qt 5.3.1 release (unless someone else does it first).
If you find any other issues, please report them to https://bugreports.qt-project.org/ -- posts here usually won't be seen by devs.
-
Hi JKSH,
I like to volunteer for this!
Rgds, Steven
-