示例#1
0
            def mouseReleaseEvent(self, event):
                QGraphicsView.mouseReleaseEvent(self, event)
                if event.button() != Qt.LeftButton:
                    return
                _start_pos = self.plotItem.items[0].mapFromScene(
                    self._start_pos)
                _end_pos = self.plotItem.items[0].mapFromScene(event.pos())
                sx, sy = _start_pos.x(), _start_pos.y()
                ex, ey = _end_pos.x(), _end_pos.y()
                if sx > ex: sx, ex = ex, sx
                if sy < ey: sy, ey = ey, sy
                data = self.scatter.data
                selected_indices = ((sx <= data['x']) & (data['x'] <= ex) &
                                    (ey <= data['y']) &
                                    (data['y'] <= sy)).nonzero()[0]
                self._selection.extend(selected_indices)

                data['pen'][selected_indices] = self.SELECTED_PEN
                self.scatter.points()
                for item in data['item'][selected_indices]:
                    item.updateItem()

                print(data['data'][selected_indices])
示例#2
0
    def mouseReleaseEvent(self, event):
        if event.button() & Qt.LeftButton:
            self.__stopAutoScroll()

        return QGraphicsView.mouseReleaseEvent(self, event)
示例#3
0
    def mouseReleaseEvent(self, event):
        if event.button() & Qt.LeftButton:
            self.__stopAutoScroll()

        return QGraphicsView.mouseReleaseEvent(self, event)