keyReleaseEvent not called
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:
Code:
CustomQGraphicsTextItemClass *oneTextNode=new CustomQGraphicsTextItemClass();
scene()->addItem(oneTextNode);
oneTextNode->setFocus();
and my custom QGraphicsItem constructor has this command:
Code:
setTextInteractionFlags(Qt::TextEditorInteraction);
The release code is the following:
Code:
void CustomQGraphicsTextItemClass
::keyReleaseEvent(QKeyEvent *e
) {
MGlobal
::displayInfo(MQtUtil
::toMString(QString().
sprintf("Release !!!!!!!")));
}
The Release function is never called. There is a keyPressEvent too, but this one gets properly called.
Thanks for your help.
Re: keyReleaseEvent not called
Can't test it right now, but when I remember right, you have to grab the keyboard first to receive key events: QGraphicsItem::grabKeyboard().