when QGraphicsItem selected in QGraphicsScene, its bound will show in dashline.
How can i change this property?
i don't want to show dashline when QGraphicsItem selected.
Printable View
when QGraphicsItem selected in QGraphicsScene, its bound will show in dashline.
How can i change this property?
i don't want to show dashline when QGraphicsItem selected.
I think you'll need to create a subclass and reimplement virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) to draw the selection yourself. In order to prevent rendering of the default selection rect, you'll need to clear the QStyle::State_Selected flag from option argument:
You can test for the QStyle::State_Selected flag in paint method to render the selection your way:Code:
// header, QGraphicsItemBaseClass should be the one you want to subclass (QGraphicsPixmapItem,QGraphicsEllipseItem,...) class MyGraphicsItem:public QGraphicsItemBaseClass{ public: //... // .cpp void MyGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ QGraphicsItemBaseClass::paint(painter,&opt,widget); // render graphics item without selection rect //... }
Code:
void MyGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ //... your selection rendering method here } }