Results 1 to 3 of 3

Thread: Simple frame control doesn't resize when I hide()

  1. #1
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Simple frame control doesn't resize when I hide()

    Can someone please help me with this?

    I have received and researched several soultions to this seemingly simple task
    without finding a working one.

    I have a widget. It consists of a frame which contains some text and
    a button. Click on the button and the text disappears and the
    frame resizes to show only the button. Click on the button and the
    text reappears and the frame expands to it's previous size.

    This widget lives alone in a GroupBox on an existing form.
    It is not a top level widget.
    For now I don't care whether the form resizes or not, I just want the
    above functionality..

    No matter what I try, the text disappears but the frame refuses to
    resize.

    Several people have indicated that

    layout()->setSizeConstraint(QLayout::SetFixedSize);

    is the answer. I've tried that, I believe that is only true for top level (ie Dialogs)
    widgets.

    I've attached a simple.ui file.


    many thanks...
    Mark
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Simple frame control doesn't resize when I hide()

    The size policies of the group box should be "expanding".

    Otherwise, you can use setFixedSize(sizeHint()) on the group box after you hide the label. You also must use it when showing the label.

    BTW, that UI is not useful by itself. There is nothing to be tested.

    Regards

  3. #3
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Simple frame control doesn't resize when I hide()

    I must be an idiot but this continues to be a problem for me.
    The attached ui resizes as I would like in QT Designer preview.

    I then add code in my test app to act on the button click and hide the HiddenText area.

    The FrameGroup does not resize down. It is set to Expanding,Expanding and
    has a minimum size of 20,44.

    I want the OuterGroup to remain fixed in size. Similarly I want the FrameGrouo
    to not be resizeable, except when the button click occurs.

    Perhaps I don't understand who controls who in the layout process...

    This is driving me nuts!

    Mark
    Attached Files Attached Files

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.