Results 1 to 3 of 3

Thread: Resize widget to layout inside it.

  1. #1
    Join Date
    Jan 2012
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Resize widget to layout inside it.

    Hi. I'm pretty new in Qt so my question might be stupid, but I can't figure out how to handle my problem.

    I have widget with buttons and lineedits inside. Amount of buttons in widget depends on which item is currently selected in QTreeWidget. I added QScrollArea in order to have my widget always in the same size, regardless of how many buttons/lineedits is inside it. But it doesn't work as I want to. I set minimumSize of widget to (200, 150) to see anything. But its too big for 2 buttons and too small for e.g. 20. So I want to resize my widget depending on how many items are in my widget, and I have no idea how to achive that.

    PS. Sorry for my English. I'm not a navitve english speaker, and I'm still learning.

  2. #2
    Join Date
    Jan 2012
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Resize widget to layout inside it.

    Problem solved.

    I set setSizeConstraint(QLayout::SetNoConstraint) to layout and everything is as i wanted to

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Resize widget to layout inside it.

    I'm not sure this is the right approach. If you post some screenshots or better yet a ui file, maybe we'll suggest a more appropriate solution.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 18th January 2011, 16:59
  2. Replies: 4
    Last Post: 4th December 2009, 10:04
  3. Resize widget force layout resizing
    By ^NyAw^ in forum Qt Programming
    Replies: 17
    Last Post: 11th February 2009, 11:27
  4. resize buttons inside
    By eleanor in forum Qt Programming
    Replies: 8
    Last Post: 21st October 2007, 05:21
  5. How do I move a widget inside a grid Layout
    By barnabyr in forum Newbie
    Replies: 1
    Last Post: 8th May 2006, 23:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.