Home > database >  How to add "status bar" to QT widget - without using QTDesigner
How to add "status bar" to QT widget - without using QTDesigner

Time:10-16

I am creating QT QEditText widget (C ) dynamically at run time. I cannot use "static ways" AKA QTDesigner to add / design the widget - it is NOT a form. I know "status bar" is used as default in "MainWindow". I want to add same functions in QTextEdit.

The QT doc has an example of C code on how to use "status bar" in MainWindow - that is of little help.

I have added this code to the QTextEdit constructor

  childStatusBar = new QStatusBar();
childStatusBar->setStatusTip(" Show current copy drag  and drop text");
childStatusBar->showNormal();
childStatusBar->showMessage("Status test message");

It compiles and runs, but there is no "status bar". I do not know what is missing in my code and would appreciate an assistance in solving this issue.

(Links , references to code examples would be helpful)

Please make sure to read the post and replay with facts, not opinions. Suggestion for alternates are NOT solutions.

Please avoid any format of "ask your friend", RTFM. Been there, done that.

As far as Mt Higgins is concerned, I am not asking for editing my post - I am not posting to get a lecture in English grammar or composition.

Cheers and "... thanks for watching..."

CodePudding user response:

Just create a Qt MainWindow or Widget example and create a statusbar on it. Build the project and you can find your ui_...h in your build directory. Open it and find the QStatusBar widget. You can copy from there.

Note: Layouts are very important in Qt. So don't forget main-widget / main-window main layout and it's relation with statusbar. And also statusbar's layout.

CodePudding user response:

As we can see in enter image description here

and also QTextEdit has a setStatusTip function that you can add "Show current copy drag and drop text" there instead of childStatusBar.

enter image description here

  •  Tags:  
  • c qt
  • Related