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.
-
Hi
Well its only possible via code.
You simply insert in after setupUI() been run in constructor
QStatusBar *bar = new QStatusBar(this);
ui->somelayout->addWidget(bar);Often you need a layout to keep it to the bottom but sounds like you
already have that. -
Hi,
What kind of layout do you use in your widget ? How are you using it ?
-
@Rututraj
Hi
well an easy way is just to use a member variable.so instead of
QStatusBar *bar = new QStatusBar(this); // local variablewe do
bar = new QStatusBar(this); // memeber variableand in .h (in the class) we have
QStatusBar *bar = nullptr; // moed to be a memberand then you can just use bar-> to talk to it.
-
@Mark81 Feel free to provide a patch :)