Use Stroker to generate Edge selection area
This commit is contained in:
committed by
Yorik van Havre
parent
545bed8b15
commit
860ad6b913
@@ -93,6 +93,20 @@ Qt::PenStyle QGIEdge::getHiddenStyle()
|
||||
return hidStyle;
|
||||
}
|
||||
|
||||
QRectF QGIEdge::boundingRect() const
|
||||
{
|
||||
return shape().controlPointRect();
|
||||
}
|
||||
|
||||
QPainterPath QGIEdge::shape() const
|
||||
{
|
||||
QPainterPath outline;
|
||||
QPainterPathStroker stroker;
|
||||
stroker.setWidth(2.0);
|
||||
outline = stroker.createStroke(path());
|
||||
return outline;
|
||||
}
|
||||
|
||||
void QGIEdge::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
@@ -37,7 +37,9 @@ public:
|
||||
enum {Type = QGraphicsItem::UserType + 103};
|
||||
|
||||
int type() const { return Type;}
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual QPainterPath shape() const override;
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) override;
|
||||
|
||||
int getProjIndex() const { return projIndex; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user