phil_n
5th April 2014, 16:29
Hi all,
I'm studying this book "C++ GUI programming with Qt4" trying to learn it but my C++ was always rudamentary and even that is very rusty. I'm trying to make sure I understand it rather than just copy out examples. So in one of the examples there is this construct:
FindDialog::FindDialog(QWidget *parent) : QDialog(parent)
wich is described in the text this way:
we pass on the parent parameter to the base class constructor
then it's instantiated like this:
FindDialog *dialog = new FindDialog;
ie. with no parameters.
Can anybody explain what is going on here? Or where I can read up on it (in newbie speak)?
I know it's sub-classing QDialog but what does 'parent' refer to? Where does it come from?
Thanks.
I'm studying this book "C++ GUI programming with Qt4" trying to learn it but my C++ was always rudamentary and even that is very rusty. I'm trying to make sure I understand it rather than just copy out examples. So in one of the examples there is this construct:
FindDialog::FindDialog(QWidget *parent) : QDialog(parent)
wich is described in the text this way:
we pass on the parent parameter to the base class constructor
then it's instantiated like this:
FindDialog *dialog = new FindDialog;
ie. with no parameters.
Can anybody explain what is going on here? Or where I can read up on it (in newbie speak)?
I know it's sub-classing QDialog but what does 'parent' refer to? Where does it come from?
Thanks.