[PyQt] Collapse/expand frame

Hans-Peter Jansen hpj at urpla.net
Fri Aug 14 09:01:00 BST 2009


Am Freitag, 14. August 2009 schrieb Scott Ballard:
> Thanks for all the feedback. Are there any good tutorials for
> implementing your own custom widgets/layouts? (if no one has an
> implementation of this)

Here is one:
http://doc.trolltech.com/qq/qq26-pyqtdesigner.html

and another:
http://diotavelli.net/PyQtWiki/Using_Python_Custom_Widgets_in_Qt_Designer

One downside of subclassing QWidget is the layout manager from Mac OS-X 
using maximum spacing around it, see "my" thread: QStyle manipulations. 
If you're not targetting that OS, you don't need to care. 

>  Cheers,
>  -Scott
>
>  Alexei Puzikov 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 see - why don't you BYO. This kind of widget is uncommon, and thus the
> reason not being available already.
>
> But it's pretty easy to combine basic widgets to a composite one. And due
> to Qts powerful layout machinery, you mostly don't need to care about the
> implicit widget resize.
>
>
> Actually, you do, as soon as you'll pass over some amount of controls.
>
> I have the editor here that reimplements the screenshot (it's Maya, btw)
> and in worst situations contains approx. 4500 controls. And I'm still
> unable to remove
> flickering on switch - basically, the layout refresh.
>
> If anybody can prototype something that works with big amount of controls
> - his help would be enormous. Really.

Hmm, Alexei, please don't feel offended, but presenting 4500 controls to 
user basically sounds like a pathologic situation, where _concepts_ lost 
control ;-)... How is a user supposed to master that? Something similar to 
car navigation for the screen? (Take the second branch right, move mouse 
200mm north, you reached your target, it's on the left side..)

Even, if that widget, or control, if you like, is implemented in C++, as 
long as it is resizing itself, flickering cannot be suppressed, since it 
forces Qt to redraw the whole frame. I would start looking, how to get the 
whole thing into managable pieces. Next you may try to use a home grown 
layout manager, that is optimized for these cases (e.g. moves screen areas, 
but that's going to be tough, don't it?)

Pete



More information about the PyQt mailing list