Exemplo n.º 1
0
 def __init__(self, labelText="", position=LEFT, parent=None):
     super(LabelledTextEdit, self).__init__(parent)
     self.label = QtWidgets.QLabel(labelText)
     self.textEdit = QtWidgets.QTextEdit()
     self.label.setBuddy(self.textEdit)
     layout = QtWidgets.QBoxLayout(
         QtWidgets.QBoxLayout.LeftToRight if position ==
         LEFT else QtWidgets.QBoxLayout.TopToBottom)
     layout.addWidget(self.label)
     layout.addWidget(self.textEdit)
     self.setLayout(layout)
Exemplo n.º 2
0
def layout_factory(layout: str):
    """
    Factory function for generating instances of `PySide6.QtWidgets.QLayout`. 

    Parameters
    ----------
    1. **layout** : ``str``
        Type of layout being constructed. Allowable values: `vertical-box`, `horizontal-box`. If `layout=None`, a `PySide6.QtWidgets.QBoxLayout` will be returned.
    """
    widget = QtWidgets.QWidget()

    if layout == 'vertical-box':
        widget.setLayout(QtWidgets.QVBoxLayout())

    elif layout == 'horizontal-box':
        widget.setLayout(QtWidgets.QHBoxLayout())

    else:
        widget.setLayout(QtWidgets.QBoxLayout())

    return widget