[PySide] combining two default widgets

Sebastian Elsner sebastian at risefx.com
Sun Oct 20 11:10:55 CEST 2013


I have never tried multiple inheritance in Qt and I have never seen it
anywhere in the docs or online, so I guess its not a good option. Also
how should the system know what to paint where and how. I have created
an example on how I would approach this. It uses standard Qt paint
controls and also stays in-style on different platforms:



Am 20.10.2013 07:37, schrieb Frank Rueter | OHUfx:
> Hi all,
> I have written a custom comboBox which renders like a progress bar. 
> Depending on which item is chosen, the progress bar is updated accordingly:
> http://pastebin.com/yWACCHH0)
> Initially I thought I'd be cheeky and try to inherit both QComboBox and 
> QProgessBar (in that order) to see if this is the easiest way to do 
> this, but the app crashed as soon as I used self.setItems() in the 
> constructor.
> I don't have a lot of experience with inheriting more than one object, 
> so thought I'd ask you guys for general guide lines (if there are any). 
> I'd imagine it's only safe to do if you know that none of the respective 
> attributes cause conflicts?!
> Also, is the above code an ok way of doing this? I would just like to 
> know if this is how the pros would do it and avoid bad habits.
> Cheers,
> frank
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

More information about the PySide mailing list