0

I am selecting items using the default QRubberBand enabled by setting QGraphicsView.setDragMode() to rubber band selection. This works fine, however when an item is selected it appears with a grey dotted line around it's bounding rect and I was wondering if there is any way to prevent this?

4

1 回答 1

0

看来这样做的唯一方法是重写 QGraphicsItem::paint()。

如果项目被选中,标准项目的paint() 的默认实现将改变笔。但由于标准项目可能包含 1 行 paint() 调用,因此更改这是微不足道的。

例如在 QGraphicsLineItem 中它只是painter.drawLine(line());

于 2013-01-30T13:30:25.623 回答