QT 4.5 - Changing the selection marquee for QGraph

2019-06-22 08:31发布

Is it possible to define the style of the selection marquee when a QGraphicsItem is set selectd via setSelected(true)?

标签: qt4
2条回答
Rolldiameter
2楼-- · 2019-06-22 09:09

Technically no.

After a quick look into Qt's source code, it seems that the standard item types QGraphics*Item have the dashed outline as a default behavior. You can work around this by subclassing your own QGraphicsItem.

if (option->state & (QStyle::State_Selected | QStyle::State_HasFocus))
    qt_graphicsItem_highlightSelected(this, painter, option);

I guess you can not change the "style". This seems to be a very static feature of the standard QGraphicsItems.

Hope that helps!

查看更多
登录 后发表回答