EarthHobbit
19th April 2015, 09:33
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->setFlags(QGraphicsItem::ItemIsFocusable);
oneTextNode->setFocus();
and my custom QGraphicsItem constructor has this command:
setTextInteractionFlags(Qt::TextEditorInteraction) ;
The release code is the following:
void CustomQGraphicsTextItemClass::keyReleaseEvent(QKey Event *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.
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->setFlags(QGraphicsItem::ItemIsFocusable);
oneTextNode->setFocus();
and my custom QGraphicsItem constructor has this command:
setTextInteractionFlags(Qt::TextEditorInteraction) ;
The release code is the following:
void CustomQGraphicsTextItemClass::keyReleaseEvent(QKey Event *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.