Solved Qt inheritance
-
Hi,
What does that part of "implimentation" below mean simply please?
class FindDialog : public QDialog // header { Q_OBJECT public: FindDialog(QWidget *parent = 0); ... FindDialog::FindDialog(QWidget *parent) // implimentation : QDialog(parent) { ... int main(int argc, char *argv[]) // main.cpp { QApplication app(argc, argv); FindDialog *dialog = new FindDialog; dialog->show(); return app.exec(); }
Does that mean we send a pointer to QWidget to the base class, QDialog?
-
Hi,
You are passing the parent parameter to the base class.
-
And that parent parameter is a pointer to QWidget, yes?
If yes, so our class "FindDialog" doesn't have a parent here and is a top-level widget in our project. Yes, please?
-
Yes, you didn't set any direct parent there.
FindDialog *dialog = new FindDialog
So it just shows one instance of your
FindDialog
which hasQDialog
as its base class -
@Pl45m4
Thank you.