Beispiel #1
0
    def _add_selection(self, item):
        """Add selection rooted at item
        """
        outline = self._selection_poly(item)
        selection_item = QGraphicsPolygonItem(self)
        #         selection_item = QGraphicsPathItem(self)
        selection_item.setPos(self.contentsRect().topLeft())
        #         selection_item.setPen(QPen(Qt.NoPen))
        selection_item.setPen(make_pen(width=1, cosmetic=True))

        transform = self._itemgroup.transform()
        path = transform.map(outline)
        margin = 4
        if item.node.is_leaf:
            path = QPolygonF(path.boundingRect().adjusted(
                -margin, -margin, margin, margin))
        else:
            pass
#             ppath = QPainterPath()
#             ppath.addPolygon(path)
#             path = path_outline(ppath, width=margin).toFillPolygon()

        selection_item.setPolygon(path)
        #         selection_item.setPath(path_outline(path, width=4))
        selection_item.unscaled_path = outline
        self._selection[item] = selection_item
        item.setSelected(True)
    def _add_selection(self, item):
        """Add selection rooted at item
        """
        outline = self._selection_poly(item)
        selection_item = QGraphicsPolygonItem(self)
#         selection_item = QGraphicsPathItem(self)
        selection_item.setPos(self.contentsRect().topLeft())
#         selection_item.setPen(QPen(Qt.NoPen))
        selection_item.setPen(make_pen(width=1, cosmetic=True))

        transform = self._itemgroup.transform()
        path = transform.map(outline)
        margin = 4
        if item.node.is_leaf:
            path = QPolygonF(path.boundingRect()
                             .adjusted(-margin, -margin, margin, margin))
        else:
            pass
#             ppath = QPainterPath()
#             ppath.addPolygon(path)
#             path = path_outline(ppath, width=margin).toFillPolygon()

        selection_item.setPolygon(path)
#         selection_item.setPath(path_outline(path, width=4))
        selection_item.unscaled_path = outline
        self._selection[item] = selection_item
        item.setSelected(True)