promoted widget constructor not called
-
Hi
I have a customized QTableView class with constructor as belowiTableView::iTableView(QWidget *parent):
QTableView(parent)
{
qDebug()<<Q_FUNC_INFO;
}in QtDesigner I promoted a QTableView widget in my mainwindow ui to iTableView
when I run program the constructor does not get called / no debug is visible
I check ui_mainwindow.h and I can see
rw = new QWidget();
TV_rw = new iTableView(rw); -
Hi
I have a customized QTableView class with constructor as belowiTableView::iTableView(QWidget *parent):
QTableView(parent)
{
qDebug()<<Q_FUNC_INFO;
}in QtDesigner I promoted a QTableView widget in my mainwindow ui to iTableView
when I run program the constructor does not get called / no debug is visible
I check ui_mainwindow.h and I can see
rw = new QWidget();
TV_rw = new iTableView(rw);@Seb-Tur said in promoted widget constructor not called:
TV_rw = new iTableView(rw);If this line is executed then
iTableView::iTableView(QWidget *parent)will be called (assuming your class declaration in.his correct and constructor shown is indeed read in) . Put a breakpoint on the calling line to see if it is hit?There is nothing special about designer code or promotion. You can see the
.hfiles generated so then it is just C++ code. You will have to diagnose this yourself: do a clean rebuild, make sure the.cpp/.h/ui_....hfiles are all in the right place and it's not picking up an old one, etc. -
@Seb-Tur said in promoted widget constructor not called:
TV_rw = new iTableView(rw);If this line is executed then
iTableView::iTableView(QWidget *parent)will be called (assuming your class declaration in.his correct and constructor shown is indeed read in) . Put a breakpoint on the calling line to see if it is hit?There is nothing special about designer code or promotion. You can see the
.hfiles generated so then it is just C++ code. You will have to diagnose this yourself: do a clean rebuild, make sure the.cpp/.h/ui_....hfiles are all in the right place and it's not picking up an old one, etc.@JonB
It was probably due to some kind of glitch that in global "promotions" dialog I had a customwidget with invalid header file specified to completely different class. It might have happended when I renamed my class files and I expect this is when it happened.Now all works I expected, thanks for trying to help and assuring me that it was nothing wrong in the code.
-
S Seb Tur has marked this topic as solved on
-
@JonB
It was probably due to some kind of glitch that in global "promotions" dialog I had a customwidget with invalid header file specified to completely different class. It might have happended when I renamed my class files and I expect this is when it happened.Now all works I expected, thanks for trying to help and assuring me that it was nothing wrong in the code.