Example #1
0
    def setupUI(self, widget):
        self.ui.setupUi(widget)
        root_widgets = [w for w in widget.children() if w.__class__.__name__ == "QWidget"]
        if len(root_widgets) == 0 or widget.layout() is not None:
            self.ui_widget = self
        else:
            self.ui_widget = root_widgets[-1]
            g = QGridLayout()
            if qtpy.API=="pyqt5":
                pass
            else:
                if isinstance(self, QtWidgetLoader):
                    g.setMargin(0)
                    g.setSpacing(0)
            widget.setLayout(g)

            g.addWidget(self.ui_widget)