promoted widget constructor not called
-
wrote on 5 Mar 2024, 11:39 last edited by Seb Tur 3 May 2024, 11:41
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);wrote on 5 Mar 2024, 11:54 last edited by@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.h
is 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
.h
files 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_....h
files 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.h
is 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
.h
files 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_....h
files are all in the right place and it's not picking up an old one, etc.wrote on 5 Mar 2024, 12:25 last edited by@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.
-
-
@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.
1/4