I think this is a good example of a custom widget:
https://www.mfitzp.com/article/qcolorbutton-a-color-selector-tool-for-pyqt/

Regarding the accordion style widget.. (I'm not familar with maya widgets) 
isn't that exactly what a QToolBox does? It also inherits from QTabWidget 
which has a method "addCornerWidget" which shoiuld make it possible to 
implement the triangle button without hacks.

Am Donnerstag, 28. Mai 2020 13:39:48 UTC+2 schrieb Erik Spellerberg:
>
> I understand it in theory but I've just never seen an example of a custom 
> widget being written. Is it just a new class that inherits QtWidget and I 
> populate it with the objects that I want? Then insert instances of that 
> class into my layout?
>
> On Wednesday, May 27, 2020 at 11:20:46 PM UTC+2, Justin Israel wrote:
>>
>>
>> If you can't fine an existing example of an "accordion" layout/widget, 
>> and you wanted to create from from scratch,  I would suggest creating a 
>> widget that has a vertical layout. The first item would be your title bar, 
>> which contain a swizzle/triangle type icon. The second item in the layout 
>> would probably be a QScrollWidget if you want the layout to handle 
>> automatically scrolling. Or it could be a QStackedWidget if you want to to 
>> set any widget into it, which may already be a scroll widget. Then you can 
>> wire up your swizzle button to toggle the visibility of the main content 
>> widget. 
>> When these individual layout items are added to another vertical layout, 
>> with either a top alignment, or having a stretcher added as the last item, 
>> the toggling of the accordion items will cause them to compress up to the 
>> top.
>>
>> Justin
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/84783315-26ab-495a-8e30-53b98542f251%40googlegroups.com.

Reply via email to