Results 1 to 2 of 2

Thread: Layout not updated when sizeHint changes

  1. #1
    Join Date
    Mar 2009
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Layout not updated when sizeHint changes

    Hi All,

    I have a QVBoxLayout with QWidget derived class which are overrideing sizeHint. The size policy for my widgets is Fixed. When I create a widget and insert it into my layout, the later process the widget's size correctly (i.e. it considers sizeHint). However when later the widget changes the value of its sizeHint the layout is not getting updated. I tried QWiddget::updateGeometry (for the parent widget of layout), and QLayout::update but neither one solved give an effect.

    How to update the layout.

    P.S. when I destroy and recreate the layout the widget sizes are shown ok, but this is very heavy operation so I don't want to go through this way.

    Thnx!

  2. #2
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Layout not updated when sizeHint changes

    Hi,

    The modified widget must notify the layout it has changed using QWidget::updateGeometry(). Doc says:

    Notifies the layout system that this widget has changed and may need to change geometry.

    Call this function if the sizeHint() or sizePolicy() have changed.
    (You must call it from within the modified widget.)

    Julien

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Qt like Layout Manager available for .NET platform
    By vkhaitan in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 13:36
  3. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 17:11
  4. Resizing problems when applying a layout
    By JimBrown in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 22:54
  5. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 07:16

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.