PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 360 - QUiLoader.createWidget() returns QWidget object for all widgets
: QUiLoader.createWidget() returns QWidget object for all widgets
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: PySide
: HEAD
: All All
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-09-15 18:41 EEST by Bajusz Tamás
Modified: 2010-10-13 13:48 EEST (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bajusz Tamás 2010-09-15 18:41:22 EEST
While I was trying to write a PyQt4 loadUi() equivalent, it seems
the QUiLoader.createWidget() returns QWidget for all widgets
instead of instances of className class.

---

from PySide import QtCore
from PySide.QtUiTools import QUiLoader

class MyQUiLoader(QUiLoader):
    def __init__(self, baseinstance):
        QUiLoader.__init__(self)
        self.baseinstance = baseinstance

    def createWidget(self, className, parent=None, name=""):
        widget = QUiLoader.createWidget(self, className, parent, name)
        print className, parent, name, widget, widget.metaObject().className() 
        if parent is None:
            return self.baseinstance
        else:
            setattr(self.baseinstance, name, widget)
            return widget

def loadUi(uifile, baseinstance=None):
    loader = MyQUiLoader(baseinstance)
    ui = loader.load(uifile)
    QtCore.QMetaObject.connectSlotsByName(ui)
    print ui.__dict__
    return ui
Comment 1 renato filho 2010-09-21 14:55:14 EEST
fixed on shiboken commit:

commit 06f1f83e0e8f39cde919bdb8a3441823bc5a5bb2
Author: renatofilho <renato.filho@openbossa.org>
Date:   Tue Sep 21 13:41:55 2010 -0300


unit test on pyside:
commit 4229fa0082135c889094c6cea7baa970b5208587
Author: renatofilho <renato.filho@openbossa.org>
Date:   Tue Sep 21 14:29:34 2010 -0300
Comment 2 renato filho 2010-09-24 17:40:25 EEST
*** Bug 357 has been marked as a duplicate of this bug. ***
Comment 3 renato filho 2010-09-24 17:48:17 EEST
*** Bug 380 has been marked as a duplicate of this bug. ***
Comment 4 renato filho 2010-10-13 13:48:42 EEST
released on PySide 0.4.2