Now I am rewrite the function paint() of the QGraphicsPolygonItem,For example :
{
Q_UNUSED(widget);
if (dd->control) {
painter->save();
QRectF r
= option
->exposedRect;
painter->translate(-dd->controlOffset());
r.translate(dd->controlOffset());
dd->control->drawContents(painter, r);
painter->restore();
}
if (option
->state
& (QStyle::State_Selected |
QStyle::State_HasFocus)) qt_graphicsItem_highlightSelected(this, painter, option);
}
void QGraphicsTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
Q_UNUSED(widget);
if (dd->control) {
painter->save();
QRectF r = option->exposedRect;
painter->translate(-dd->controlOffset());
r.translate(dd->controlOffset());
dd->control->drawContents(painter, r);
painter->restore();
}
if (option->state & (QStyle::State_Selected | QStyle::State_HasFocus))
qt_graphicsItem_highlightSelected(this, painter, option);
}
To copy to clipboard, switch view to plain text mode
the last two sentences is the Selected state,and delete them.
Bookmarks