Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using QStatusBar with QWidget instead of QMainWindow.



  • The official Qt documentation states that "Typically, a request for the status bar functionality occurs in relation to a QMainWindow object". The use of the word "typically" as opposed to "always" leads me to wonder if a status bar can occur, albeit less often, in relation to QWidget or something else? Although, I've noticed that there isn't a setStatusBar() method for QWidget like there is for QMainWindow. When I assign a layout to the Qwidget the call addWidget(), the status bar acts like any normal widget in the layout, and not like the status bar in QMainWindow. The reason why I'm thinking about using a statusbar with the QWidget is that I've been unable to resolve my problem of not being able to use a repeating SVG pattern as a backround in a QMainWindow, so I'm hoping I can keep using QWidget as the main window and keep the SVG.


  • Lifetime Qt Champion

    Hi
    You can just new a QStatusBar and insert it into what ever you want.
    Unlike mainwindow and its setStatusBar() , one difference is that its up to you
    to use layout to keep it aligned to bottom of the Widget.


Log in to reply