Qt World Summit: Register Today!

QLabel() setScaledContents and toolbars/menubars

  • Hi all,

    I'm creating an application that displays an image inside of a QMainWindow using QLabel. With setScaledContents, everything works perfectly except for one minor thing. When an image is scaled to fit the size of the window, it does not account for the menu bar nor the tool bar. Thus, part of the image isn't shown as both the menu bar and the tool bar are covering it. Is there a way around this functionality?


  • Moderators

    how do you add the QLabel, status-bar and tool-bar to the main window?
    By setting it via setCentralWidget() the described effect doesn't occur of course, since it doesn't make any sense that the tool- and status-bar overlap the content widget.

  • They are called by QMainWindow. With setCentralWidget() I was able to resolve the issue by adding in pixels to the height of the QMainWindow to make up for the difference in space.

Log in to reply