[PySide] QtUiTools.QUiLoader crash with custom widget
Tyler W. Wilson
tyler at tylerlabs.com
Mon Apr 30 17:16:50 CEST 2012
Ditto on this issue for me. I just ran into this as well trying to add a
custom widget to a designer-based application. I had to move to PyQt4
temporarily to make it work.
Thanks,
Tyler
On 4/30/2012 9:58 AM, Stefan wrote:
> Hi,
>
> I'm trying to create a QMainWindow in the Designer and load the ui file
> dynamically with QUiLoader in pyside 1.1.0. When I don't register any
> custom types it works, but obviously fails to create my derived class.
> When I register them it crashes. Here's a small example that crash for
> me on windows running python 2.7 and pyside 1.1.0:
>
> from PySide import QtCore, QtGui, QtUiTools
> import sys
>
> class MyWidget(QtGui.QWidget):
> def __init__(self, parent=None):
> super(MyWidget, self).__init__(parent)
>
> if __name__ == '__main__':
> application = QtGui.QApplication(sys.argv)
>
> loader = QtUiTools.QUiLoader()
> loader.registerCustomWidget(MyWidget)
> print loader.availableWidgets()
> print loader.createWidget('QLabel')
> print loader.createWidget('MyWidget')
>
> Running this prints the following:
>
> [u'AnalogClock', u'CompositionRenderer', u'GradientEditor',
> u'GradientRendererEx
> ', u'MultiPageWidget', u'MyWidget', u'PathDeformRendererEx',
> u'PathStrokeRendere
> rEx', u'Phonon::SeekSlider', u'Phonon::VideoPlayer',
> u'Phonon::VolumeSlider', u'
> QAxWidget', u'QCalendarWidget', u'QCheckBox', u'QColumnView',
> u'QComboBox', u'QC
> ommandLinkButton', u'QDateEdit', u'QDateTimeEdit', u'QDeclarativeView',
> u'QDial'
> , u'QDialog', u'QDialogButtonBox', u'QDockWidget', u'QDoubleSpinBox',
> u'QFontCom
> boBox', u'QFrame', u'QGraphicsView', u'QGroupBox', u'QLCDNumber',
> u'QLabel', u'Q
> LineEdit', u'QListView', u'QListWidget', u'QMainWindow', u'QMdiArea',
> u'QMenu',
> u'QMenuBar', u'QPlainTextEdit', u'QProgressBar', u'QPushButton',
> u'QRadioButton'
> , u'QScrollArea', u'QScrollBar', u'QSlider', u'QSpinBox', u'QSplitter',
> u'QStack
> edWidget', u'QStatusBar', u'QTabWidget', u'QTableView', u'QTableWidget',
> u'QText
> Browser', u'QTextEdit', u'QTimeEdit', u'QToolBar', u'QToolBox',
> u'QToolButton',
> u'QTreeView', u'QTreeWidget', u'QWebView', u'QWidget', u'QWizard',
> u'QWizardPage
> ', u'QWorkspace', u'TicTacToe', u'WorldTimeClock', u'XFormRendererEx']
> <PySide.QtGui.QLabel object at 0x02B591C0>
> *crash*
>
> So it the class is in there, it manages to create a QLabel, but then it
> crashes.
>
> Any ideas why? I don't have any pdb for python, so it's hard to get a
> callstack.
>
> /Stefan
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
More information about the PySide
mailing list