Beispiel #1
0
    def __init__(self, attrs, parent=None):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(4, 0, 4, 4)

        self.__attrs = attrs
        self.__scroll = QtGui.QScrollArea(self)
        self.__scroll.setWidgetResizable(True)
        self.__scroll.setFocusPolicy(QtCore.Qt.NoFocus)
        self.layout().addWidget(self.__scroll)
Beispiel #2
0
    def __init__(self, parent=None):
        super(DragDropList, self).__init__(parent)

        self.setFrameStyle(self.Panel|self.Sunken)
        self.setAcceptDrops(True)

        self._buttonGroup = QtGui.QButtonGroup(self)
        self._buttonGroup.setExclusive(True)

        header = QtGui.QWidget(self)
        header.setFixedHeight(20)
        headerLayout = QtGui.QHBoxLayout(header)
        headerLayout.setSpacing(0)
        headerLayout.setContentsMargins(8, 0, 8, 0)
        self._headerLayer = headerLayout

        self._contentWidget = content = QtGui.QWidget(self)
        scroll = QtGui.QScrollArea(self)
        scroll.setFrameStyle(self.Panel|self.Raised)
        scroll.setWidgetResizable(True)
        scroll.setWidget(content)
        scrollLayout = QtGui.QVBoxLayout(content)
        scrollLayout.setSpacing(0)
        scrollLayout.setContentsMargins(0, 0, 0, 0)

        self._itemLayout = QtGui.QVBoxLayout()
        self._itemLayout.setSpacing(self.ITEM_SPACING)
        self._itemLayout.setContentsMargins(0, 12, 0, 12)

        scrollLayout.addLayout(self._itemLayout)
        scrollLayout.addStretch()

        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(4, 4, 4, 4)

        layout.addWidget(header)
        layout.addWidget(scroll)

        # Connections
        self._buttonGroup.buttonClicked.connect(self.itemClicked)