Exemplo n.º 1
0
    def widget(self, container):
        """Get a widget containing all the fields of the given container.

        :param container: ContainerField instance.
        """
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtGui.QFrame.StyledPanel)
        layout = QtWidgets.QFormLayout(widget)
        for field in container.fields:
            layout.addRow(field.name, field.widget())
        return widget
Exemplo n.º 2
0
    def widget(self):
        """Get a the QWidget displaying the Component data.

        Users can override this method if they wish to customize the layout of the component.
        :return: A QWidget containing all the Component fields.
        """
        widget = QtWidgets.QWidget()
        layout = QtWidgets.QFormLayout(widget)
        for field in self.fields:
            if field.display_name:
                layout.addRow(field.verbose_name, field.widget())
            else:
                layout.addWidget(field.widget())
        return widget