I have a question, who is responsible for deletion of QEvent objects? For example, in the code below I create a new QEvent object and pass it further to parent:
void IxGwText
::keyPressEvent(QKeyEvent *event
) {
if(text != "")
{
text = text.toLower();
newEvent
= new QKeyEvent(event
->type
(), event
->key
(), event
->modifiers
(), text
);
}
else
{
}
}
void IxGwText::keyPressEvent(QKeyEvent *event)
{
QString text = event->text();
QKeyEvent *newEvent;
if(text != "")
{
text = text.toLower();
newEvent = new QKeyEvent(event->type(), event->key(), event->modifiers(), text);
QGraphicsTextItem::keyPressEvent(newEvent);
}
else
{
QGraphicsTextItem::keyPressEvent(event);
}
}
To copy to clipboard, switch view to plain text mode
newEvent is a newly created event. Is there a memory leak? Who handles the event object deletion? Thanx!
Bookmarks