Well, you have some unfortunate naming scheme here.So he has a pointer of class of the same class
class Dialog from line 1 (which inherits QDialog) is not the same as class Dialog forward declared in the Ui namespace.
Ui::Dialog refers to the class which is automatically generated by uic from the *.ui file, in order to translate your visual design into c++ code needed to setup the interface (btw. this Ui:: class will have the same name as the main object in your .ui form).
So it's important to understand the difference - Dialog is a class which implements the logic of QDialog, but Ui::Dialog is a class which implements the user interface setup. Those two are not the same class.
When you call ui->setupUi(widget), you are telling the ui object to apply the interface setup on a given widget. It makes the widget look like the stuff you edited with designer, basically.
Here, a this pointer is passed, which means to setup the look of current object.
This is all quite simple, but I understand the confusion caused by the Dialog name.
I hope it's more clear for you now.
Sorry but now I'm confusedhe 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??![]()





Reply With Quote
Bookmarks