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.

    #include "foo.h"

    QT_BEGIN_NAMESPACE

    class Ui_MainWindow
    {
    public:
    // many items
    foo *textBrowserOutput;
    QStatusBar *statusBar;

    void setupUi(QMainWindow *MainWindow)
    {
    // many items
    textBrowserOutput = new foo(centralWidget);
    textBrowserOutput->setObjectName(QStringLiteral("textBrowserOutput"));
    }

    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


  • Qt Champions 2016

    Hi
    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


  • Qt Champions 2016

    @Tomhk
    Ok?!
    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.


  • Qt Champions 2016

    @Tomhk
    And then it works?



  • Yes. Anyway thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.