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. Auto expanding QLabel

Auto expanding QLabel

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

    Hi folks, today I have a design issue.
    I would like to build a QDockWidget containing an image in a QLabel.

    Now when undocking this QDockWidget, I would like to be able to resize it and have the QLabel take all the space.
    Is it possible without reimplementing the resizeEvent of my dock? Just with strings and any value editable through designer?
    Thanks a lot!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      You need to apply the correct layout to the widget, and give it the sizePolicy you need.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        Thanks for your help but could you detail your answer a bit?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Not without you detailing the layout that you made now ;-)

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JulienMaille
            wrote on last edited by
            #5

            I currently have in my Qdock window
            @<--Spacer-->QLabel<--Spacer--->
            ^
            |
            Spacer
            |
            V@ But obviously this is not the right way to do this.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              No, in this way, the spacers are probably eating up your additional space (unless they have a fixed size). What do you have the spacers in there for exactly?

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JulienMaille
                wrote on last edited by
                #7

                Right now it has a fixed size.
                But I would like to switch to the behavior i mentionned in my first post.
                I tried to remove all spacers, set the QLael policy to minimum expanding, and set a base size.
                -> aspect ratio is lost
                -> when docked it takes too much 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