예제 #1
0
    def __init__(self, parent=None):
        QAbstractItemView.__init__(self, parent)
        self.horizontalScrollBar().setRange(0, 0)
        self.verticalScrollBar().setRange(0, 0)

        self.validItems = 1
        self.totalValue = 0.0
        self.setMouseTracking(True)
        self.highlight = None
        self.old_highlight = None
        self.fm = None
예제 #2
0
    def rowsAboutToBeRemoved(self, parent, start, end):

        if not self.model():
            return
        row = start
        while row <= end:

            index = self.model().index(row, 1, self.rootIndex())
            value = self.model().data(index).toDouble()[0]
            if value > 0.0:
                self.totalValue -= value
                self.validItems -= 1

            row += 1

        QAbstractItemView.rowsAboutToBeRemoved(self, parent, start, end)
예제 #3
0
    def _filter_drag_move(self, event):
        QAbstractItemView.dragMoveEvent(self.filterTreeWidget, event)
        source = self.filterTreeWidget.currentItem()
        target = self.filterTreeWidget.itemAt(event.pos())
        if not target:
            event.ignore()
            return

        source_top = source.parent()
        if source_top.parent():
            source_top = source_top.parent()
        target_top = target
        if target_top.parent():
            target_top = target_top.parent()
        if target_top.parent():
            target_top = target_top.parent()

        # Drag and Drop is only allowed for the same filter type
        if source_top != target_top:
            event.ignore()
            return

        # Groups can only be dragged to top level
        if source.data(1, Qt.UserRole) == self.FilterTreeRoleGroup:
            if target.data(1, Qt.UserRole) == \
                    self.FilterTreeRoleGroup:
                event.ignore()
                return
            if target.parent() != target_top and target != target_top:
                event.ignore()
                return

        # This strange hack prevents from dragging to root level
        if source_top == target:
            pos = event.pos()
            pos.setY(pos.y() - 2)
            higher_target = self.filterTreeWidget.itemAt(pos)
            if target != higher_target:
                event.ignore()
예제 #4
0
    def _filter_drag_move(self, event):
        QAbstractItemView.dragMoveEvent(self.filterTreeWidget, event)
        source = self.filterTreeWidget.currentItem()
        target = self.filterTreeWidget.itemAt(event.pos())
        if not target:
            event.ignore()
            return

        source_top = source.parent()
        if source_top.parent():
            source_top = source_top.parent()
        target_top = target
        if target_top.parent():
            target_top = target_top.parent()
        if target_top.parent():
            target_top = target_top.parent()

        # Drag and Drop is only allowed for the same filter type
        if source_top != target_top:
            event.ignore()
            return

        # Groups can only be dragged to top level
        if source.data(1, Qt.UserRole) == self.FilterTreeRoleGroup:
            if target.data(1, Qt.UserRole) == \
                    self.FilterTreeRoleGroup:
                event.ignore()
                return
            if target.parent() != target_top and target != target_top:
                event.ignore()
                return

        # This strange hack prevents from dragging to root level
        if source_top == target:
            pos = event.pos()
            pos.setY(pos.y() - 2)
            higher_target = self.filterTreeWidget.itemAt(pos)
            if target != higher_target:
                event.ignore()
예제 #5
0
 def __init__(self):
     super(Loop_Test, self).__init__()
     self.setupUi(self)
     
     self.setWindowTitle("Loop Test Results")
     
     self.tableWidget.setRowCount(0)
     self.tableWidget.setColumnCount(1)
     self.tableWidget.setHorizontalHeaderLabels(["Test Name"])
     
     self.clearBtn.clicked.connect(self.clear_window)
     self.closeBtn.clicked.connect(self.close_window)
     
     self.tableWidget.itemClicked.connect(self.OpenResultFile)
     
     self.tableWidget.setEditTriggers(QAbstractItemView.EditTrigger(0))
예제 #6
0
 def mouseReleaseEvent(self, event):
     QAbstractItemView.mouseReleaseEvent(self, event)
     self.selectionRect = QRect()
     self.viewport().update()