[Qt-interest] Is the code safe when I called sendEvent(...) without a stack event?
Kermit Mei
kermit.mei at gmail.com
Fri Mar 26 10:15:06 CET 2010
Dear all,
Assistant told us that the event argument used by
QCoreApplication::sendEvent(QObject *, QEvent *) should be create in the
stack. Because the it can't be delete when send. Then I want to know
wheather the following code is safe:
void SubWidget::keypressEvent(QKeyEvent *event) {
if(needToProcessInParent() == true) {
QCoreApplication::sendEvent(parent(), QEvent *event);
return ;
}else {
processInSubWidget();
}
}
I haven't create the event on the stack, but it also need not be
deleted when it sent. So I consider it's safe. And when sendEvent(...)
called here, the SubWidget will not process the event.
Isn't it?
Thanks
B.R
Kermit
More information about the Qt-interest-old
mailing list