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. [Solved] Automatically resize QGroupBox to fit its contents.
Forum Updated to NodeBB v4.3 + New Features

[Solved] Automatically resize QGroupBox to fit its contents.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 14.7k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Bekos
    wrote on last edited by
    #1

    Hello Qters!

    I am trying to do a very simple thing but I am a little bit confuzed.
    I have a QGroupBox and inside it I have two QLabels. One has a fixed size, while the other has the property "wordWrap" enabled and its text is changing during the runtime. When I add a big text to the second QLabel the word wrapping works fine, but I can not see all the text because it is clipped by the geometry of the QGroupBox. Is there some way to automatically resize the QGroupBox based on its contents? Thanks a lot for your time and sorry for the noob-ish question! :)

    Cheers,
    Bekos

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Are you using a "layout":http://qt-project.org/doc/qt-4.8/layout.html in your group box?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bekos
        wrote on last edited by
        #3

        You are right! I had to add a layout. Actually, I tried that in the past but it did not work using the Preview mode of the QtDesigner (dunno why). But turns out that if I just run my program it works just fine!
        Thanks a lot!

        Cheers,
        Bekos

        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