How do I add a statusbar widget to a dialog in the ui designer?

  • I have a well established dialog ui and I want to add a status bar to the bottom. But apparently there is no QStatusBar to choose from in the tool box. And there is no option to promote a class to QStatusBar.

    I have tried the trick told on link stackoverflow to add a dummy widget first then manually change the object to use QStatusBar class in the generated ui header file. But the problem is every time I make a change in the designer again and try to run it, it will change back to the dummy class.

  • Lifetime Qt Champion

    Well its only possible via code.
    You simply insert in after setupUI() been run in constructor
    QStatusBar *bar = new QStatusBar(this);

    Often you need a layout to keep it to the bottom but sounds like you
    already have that.

  • @mrjj

    Thanks it works. I added a layout to the bottom of the ui, and then in my cpp file I added the statusbar to the layout and it showed up. But somehow it's still not sticking to the bottom.

  • Lifetime Qt Champion


    What kind of layout do you use in your widget ? How are you using it ?

  • @SGaist

    Hi i fixed the problem. It was caused by one of the initial functions in my cpp that outputed a layout onto the ui, which has not been constrained by the layout of the main widget.

Log in to reply

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