Hi,
I have a custom QGraphicsTextItem with a keyReleaseEvent, but this event is never called when I release a key.
This is the way I create my custom QGraphicsItem:
CustomQGraphicsTextItemClass *oneTextNode=new CustomQGraphicsTextItemClass();
scene()->addItem(oneTextNode);
oneTextNode->setFocus();
CustomQGraphicsTextItemClass *oneTextNode=new CustomQGraphicsTextItemClass();
scene()->addItem(oneTextNode);
oneTextNode->setFlags(QGraphicsItem::ItemIsFocusable);
oneTextNode->setFocus();
To copy to clipboard, switch view to plain text mode
and my custom QGraphicsItem constructor has this command:
setTextInteractionFlags(Qt::TextEditorInteraction);
setTextInteractionFlags(Qt::TextEditorInteraction);
To copy to clipboard, switch view to plain text mode
The release code is the following:
void CustomQGraphicsTextItemClass
::keyReleaseEvent(QKeyEvent *e
) {
MGlobal
::displayInfo(MQtUtil
::toMString(QString().
sprintf("Release !!!!!!!")));
}
void CustomQGraphicsTextItemClass::keyReleaseEvent(QKeyEvent *e)
{
MGlobal::displayInfo(MQtUtil::toMString(QString().sprintf("Release !!!!!!!")));
}
To copy to clipboard, switch view to plain text mode
The Release function is never called. There is a keyPressEvent too, but this one gets properly called.
Thanks for your help.
Bookmarks