Accessing status bar in main window

Is it possible to access status bar from main window as QStatusBar? I'd like to insert widget ther to display values calculated from selected elements, similar to Microsoft Excel or LibreOffice Calc.

Comments

  • The status bar can be accessed as RBA::MainWindow.instance().status_bar.

    But this is outside the official API. I can't guarantee backward compatibility in future version.

    Regards,

    Matthias

  • Hi, Matthias!

    Thank you for explanations! But is there good reason to keep MainWindow.status_bar internal and not documented? I don't think that status bar will be removed from KLayout GUI.

  • MainWindow.status_bar isn't an official API attribute.

    The mechanism is a catchall feature built into QObject for dynamic language binding. When a method can't be found, QObject looks for a child object with this name and returns a reference to it. So "status_bar" is the name of the QWidget representing the status bar. When I change the user interface, there is a chance I will remove this item and then "status_bar" won't be found or it's a different kind of widget.

    I don't want to guarantee the existence of this child widget and this would seriously constrain the development options. The only officially supported API for status bar access is "MainWindow#message".

    Matthias

  • Hi, Matthias!

    Thank you for explanations!

Sign In or Register to comment.