hi Alexey

you need call explicitly your base class constructor.

....
class UiLoader(QUiLoader):
    def __init__(self):
           QUiLoader.__init__(self)             <<<<<<<<<<<<< here
           self.widgets = {}
....

BR

On Thu, Sep 3, 2009 at 4:52 PM, Alexey Zlobin<[email protected]> wrote:
> Today i try to do similar thing by subclassing QUiLoader and overriding
> createWidget method:
>
> class UiLoader(QUiLoader):
>     def __init__(self):
>       self.widgets = {}
>     def createWidget(self, className, parent=0, name=''):
>       widget = QUiLoader.createWidget(self, className, parent, name)
>       if name != '':
>           self.widgets[name] = widget
>             return widget
>
> but get following error:
>
> Traceback (most recent call last):
>  File ".../projects/qt-designer/src/designer-sample.py", line 47, in
> <module>
>   a = DesignerSample()
>  File ".../projects/qt-designer/src/designer-sample.py", line 29, in
> __init__
>   self.widget = self.loader.load(file)
> Boost.Python.ArgumentError: Python argument types in
>   QUiLoader.load(UiLoader, QFile)
> did not match C++ signature:
>   load(QUiLoader {lvalue}, QIODevice* device, QWidget* parentWidget=None)
>
> is it bug, or feature or i do something wrong?
>
> Frédéric wrote:
>>
>> Le jeudi 27 août 2009 17:27, Antonio Valentino a écrit :
>>
>>>>
>>>> with PyQt. So, I have to put them manually:
>>>>
>>>>    def do(obj):
>>>>        for child in obj.children():
>>>>            name = str(child.objectName())
>>>>            if not name.startswith("_") and not name.startswith("qt"):
>>>>                setattr(view, name, child)
>>>>            do(child)
>>>>
>>>>    do(view)
>>>>
>>>> Don't know if it is a nice solution, but it works. There is maybe a
>>>> better way to do this?
>>>>
>>
>> BTW, could it be possible to have the QUiLoader.load() method doing this
>> for us, as the PyQt loadUi() function does?
>>
>
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.openbossa.org/listinfo/pyside
>



-- 
Renato Araujo Oliveira Filho
Instituto Nokia de Tecnologia - INdT
Mobile: +55 (81) 8704-2144
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to