[PySide] combining two default widgets

Matthew Woehlke matthew.woehlke at kitware.com
Mon Oct 21 21:28:13 CEST 2013


On 2013-10-20 01:37, Frank Rueter | OHUfx wrote:
> 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.

In C++, inheriting from QObject more than once is explicitly forbidden. 
While it *might* be possible to make this work in PySide, I wouldn't 
count on it, nor would I particularly recommend it.

What is the purpose of inheriting from both? You may be better off 
having one as an internal object of the other, similar to how there is 
an internal QLineEdit of QComboBox.

-- 
Matthew




More information about the PySide mailing list