Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel() setScaledContents and toolbars/menubars
Qt 6.11 is out! See what's new in the release blog

QLabel() setScaledContents and toolbars/menubars

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mandeepbM Offline
    mandeepbM Offline
    mandeepb
    wrote on last edited by
    #1

    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?

    Thanks,
    Mandeep

    raven-worxR 1 Reply Last reply
    0
    • mandeepbM mandeepb

      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?

      Thanks,
      Mandeep

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @mandeepb
      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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • mandeepbM Offline
        mandeepbM Offline
        mandeepb
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved