Could any one gives some hint on the easy way to get a signal emitted when the QGraphicsitem is selected/unselected each time?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can use itemChange() to get notified of that (or emit your own signal if you really need it from there):
QVariant QGraphicsItem::itemChange ( GraphicsItemChange change, const QVariant & value ) [virtual protected]
more or less like (pseudocode)
QVariant QGraphicsItemSubclass::itemChange( GraphicsItemChange change,
const QVariant &value ) {
if ( change == QGraphicsItem::ItemSelectedChange ) {
if (value == true) {
// Handling selection.. / selection emission