PyQt -> PySide: Loading ui file in __init__

525 views Asked by At

I am moving from PyQt to PySide. I have been used to load my Qt Designer generated ui files in __init__ like this:

def __init__(self):
    QtGui.QMainWindow.__init__(self)
    uic.loadUi("mygui.ui", self)

    self.mywidget.do_some_other_stuff()

    self.show()

Can this be done with PySide? The closest I've come to is

    self.widget = QtUiTools.QUiLoader().load("mygui.ui"))
    self.setCentralWidget(self.widget)

but my MatplotlibWidget won't show and none of my slots are working.

1

There are 1 answers

0
Winand On

There's implementation of loadUi for PySide in qtpy abstraction layer.