Ok. Everything works fine.
JPN, as you said the event must be allocated on the heap.
Instead of this:
QResizeEvent resizeEvent(newSize, myWidget->size());
QCoreApplication::postEvent(myWidget, &resizeEvent);
To copy to clipboard, switch view to plain text mode
I did this:
QResizeEvent* resizeEvent = new QResizeEvent(newSize, myWidget->size());
QCoreApplication::postEvent(myWidget, resizeEvent);
To copy to clipboard, switch view to plain text mode
It seems that event must be put on the heap and not on the stack. Otherwise QApplication (or whatever is responsible for removing events) can't delete it.
But the warning I had:
QEvent: Warning: event of type 14 deleted while posted to MyFrame myWidget
suggests that the event was deleted before it was posted. I initialized it in a contructor so probably the contructor has finished and all the objects initialized in it were deleted.
Thanks very much for help
Tomek
Bookmarks