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. Hide items in a QBoxLayout
QtWS25 Last Chance

Hide items in a QBoxLayout

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • E Offline
    E Offline
    Erni35
    wrote on last edited by
    #1

    Hi,

    I'm running into trouble with a layout problem. I created a layout and inserted there 3 QLabels to show pixmaps.
    The pixmaps are scaled with QT::KeepAspectRatio and showed initialy correct.
    After doubleClick on one of these Labels, the other two are hidden by hide(). The pixmap should be rescaled with the new label size. But this did not happen. Because of the backgroundcolor I know, the label is expanded after finishing the drawing of the pixmap. but not the pixmap. Another double click expands the pixmap to the correct size. How can I get the correct new size of the label in the first round? parentWidget.update() or adjustSize did not work.

    Thanks,
    Erni

    1 Reply Last reply
    0
    • M Offline
      M Offline
      messi
      wrote on last edited by
      #2

      Hi Erni35.

      The pixmap can't be larger then the height of the label if you use a QHBoxLayout. If you put three labels in a QHboxlayout the width will increase but the height will be the same. With QT::KeepAspectRatio this is exactly the behavior.

      Have you used the following function:
      void QLabel::setScaledContents ( bool )

      If you need to fillout the whole label you need Qt::IgnoreAspectRatio

      @If aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap is scaled to size.@

      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