Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is there a bug to promote widget in qt creator?
I have a program which already have a qPlainTextEdit promoted at the beginning state of the project. Now when it is almost finish, I suddenly want to promote another widget which is a qTextBrowser. So I follow the steps. But I cannot make this done. There is no error and no warning when I promote the widget. It hould be "in use" since I cannot remove the promotion by the "-" sign unless I demote the widget first. However, the promoted widget just performs as a normal widget.
In order to troubleshoot, I promote the qTextBrowser to something not exist. I promote the qTextBrowser to "Foo" Class with header "foo.h" which is not exist in my project. Surprisingly, Qt creator let me do so.
And I can even compile the project. I look into the "ui_mainwindow", it has these lines.
// many items
void setupUi(QMainWindow *MainWindow)
// many items
textBrowserOutput = new foo(centralWidget);
Then, I try to promote a widget to something not exist in a new project, I give me an error like: "foo.h: no such file or directory" and cannot complie
Sometimes you have to clean all and rebuild before the *.moc files are fully regenerated and
it complains about not finding the class.
I used the promote feature a lot and it seems to work just fine.
I have clean, run qmake and rebuild already
delete the build folder.
promote the a widget to your qTextBrowser
look in the UI files for what does it does indeed insert for your widget.
if its not of type "Your qTextBrowser" then indeed something funky is going on.
Delete the build folder does not help.
I finally open a new project, copy all .h, .cpp and one .ui file to the new project.
And then it works?
Yes. Anyway thank you.