Results 1 to 4 of 4

Thread: let parent widget grow with child widget?

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    20
    Thanks
    2
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default let parent widget grow with child widget?

    Hello,

    i have a widget which is the main window of my application. In this widget i have several other widgets. One of them should always be in a specific width/height ratio. I achieved that be overwriting of resizeEvent ( QResizeEvent * event ) of this child widget.

    Basically it works but now this widget can grow out of it boundaries.
    The layout management typically takes care that the child widgets shrink/grow with the parent. But now i would need something which makes the parent shrink/grow if a child widget requests more/less space.

    Do you have any idea how i could achieve that?

    Thanks!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: let parent widget grow with child widget?

    Send a signal from the child, catch in the parent, and resize it according to the signal

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    20
    Thanks
    2
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: let parent widget grow with child widget?

    Hi aamer4yu,

    sounds easy. :-) But the remaining question is: How do i know to which values the parent should be resized? Besically it should be resized that all child fit into it and that the parent is neither to small nor to large. But how do i tell this the parent?

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: let parent widget grow with child widget?

    Hi,

    Take a look at my post that I was asking the same:
    http://www.qtcentre.org/forum/f-qt-p...ing-18657.html
    Òscar Llarch i Galán

Similar Threads

  1. Child Widget is hogging the MouseReleaseEvent
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2009, 18:28
  2. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  3. minimize child widget
    By sreedhar in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2006, 12:02
  4. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  5. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15:13

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.