[PyQt] Collapse/expand frame

Håvard Gulldahl havard at lurtgjort.no
Thu Aug 13 22:24:03 BST 2009


On Thu, Aug 13, 2009 at 7:51 PM, Scott Ballard<scott at scottballard.net> wrote:
> I'm really looking for a frame that has the collapse/expand ability built
> into it. See the image in the link. You can see the Texture Map submenu
>  collapsed/expanded. Any thoughts?
>
> www.scottballard.net/collapsibleFrame.jpg
>

I've done something similar, sans the arrow. I have a checkable
QGroupBox, whose sole child is a QFrame with no borders. All the
widgets I put into the QFrame. Then I connect the toggled(bool) signal
of the group box to the frame's setShown(bool) slot. That way, the
QFrame is hidden when the QGroupBox is un-checked. And you can do it
all from the Qt Designer: less hand-written code, yay!

Originally I meant to figure out how to customize the QGroupBox so
that it has an arrow (like in the example you're referencing) and not
a cross, but it's not high on the list. The check box works fine, IMO.

Cheers,

Håvard


> Many thanks!
> -Scott
>
>
> Hans-Peter Jansen wrote:
>>
>> Am Mittwoch, 12. August 2009 schrieb Scott Ballard:
>>
>>>
>>> Does anyone know of a way to collapse/expand a frame or a group box that
>>> contains widgets in it? I don't see anything in the docs or Google about
>>> it, but it would seem like something common.
>>>
>>
>> Try .hide()/.show() resp. .setVisible(bool)
>>
>> Pete
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus
>> signature database 4330 (20090812) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 4332 (20090813) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Håvard Gulldahl <havard at gulldahl.no>
Telefon: 9971 0615
http://lurtgjort.no/



More information about the PyQt mailing list