Dear stampede,
the header file (generated by QT Design) has as :
1.] class Dialog : public QDialog{
2.] Q_OBJECT
3.]public:
4.] explicit Dialog(QWidget *parent = 0);
5.] ~Dialog();
6.]private:
7.] Ui::Dialog *ui;
};
at line 1 : creates a class named Dialog witch inherits the class QDialog.
at line 2 : Has the Q_OBJECT macro
at line 4 : declares as explicit the constractor method of the class with parameter a pointer of a QWidjet object
at line 5 : declares the constructor of the class
and finaly at the private sector of the class (line 7) creates a private pointer of Dialog class into the NameSpace Ui. So he has a pointer of class of the same class
The namespace of the class has been defined as Ui
namespace Ui {
class Dialog;
}
the header file.
Now. At the cpp he has as bodies of methods the followings :
1.]Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog){
2.] ui->setupUi(this);
3.]}
Dialog::~Dialog()
{
delete ui;
}
could you explain me what the line 1 does?
he declare the method Dialog(QWidget *parent) as is declared at the header file and then does multiple inheritence by passing the parent pointer to QDialog method method (parent object) and to the parent ui method as parameter pass a new UI oject that points to the Dialog??
And finaly he use the local (i mean the private ui) pointer to call the function setupUi of this object...
could you make me that clear?
Thanks!




Reply With Quote


Bookmarks