7
I work with C and a little bit of Assembly, in Atmel AVR microcontrollers. I’m trying to understand how the framework Qt extends C++.
I created a new project with Qt Creator (Widgets), and generated the following code:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), //<-- qual a relação do ponteiro acima e o parâmetro passado aqui?
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
[1] What is happening in the first row after the operator :
? is some kind of inheritance? to my look like a kind of boot, there could be this after the operator :
?
[2] In the construction of the object in the archive _main.cpp_
, where are the constructor arguments?
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w; //<-- Onde estão os argumentos?
w.show();
return a.exec();
}
If it can be explained, in a more complete way, I thank you.
very enlightening and objective his answer. The reference left was a perfect complement to exemplify the content in his reply. thank you very much.
– MacYoshi
In fact, and if I’m not mistaken, the parameter
parent
main window constructor in Qt is usually declared with a default equal to0
(null), following what the implementation ofQMainWindow
ago. :)– Luiz Vieira
@Luizvieira may be, I don’t remember this but it makes sense.
– Maniero
Very clear. It helped a lot.
– GuiDupas