[Solved]closeEvent() is not working when application is closing.
-
wrote on 28 Apr 2011, 14:26 last edited by
I have a sub class from QmlApplicationViewer in which i override the closeEvent() function, but it is not called when i press the cross on my window. Are there any other ways to catch my application is closing?
Also tried Component.onDestroying on my root element in QML file, but in this case i think some of children of this item are deleted till that moment. -
wrote on 28 Apr 2011, 16:03 last edited by
Perhaps i am doing something wrong?
@
class Test : public QWidget
{
Q_OBJECT
public:
Test(){}
virtual ~Test(){}
protected:
void closeEvent(QCloseEvent *e)
{
e->accept();
}
};
@
There is a break Point in 10 line, but debugger is not stopping on it. -
wrote on 28 Apr 2011, 18:14 last edited by
Depending on what you're trying to do, the "QCoreApplication::aboutToQuit":http://doc.trolltech.com/4.7/qcoreapplication.html#aboutToQuit signal may be helpful.
EDIT: It's good to use the right class name.
-
wrote on 29 Apr 2011, 03:01 last edited by
mlong, thank you. QCoreApplication::aboutToQuit helped me.
Even if i could not find why closeEvent is not working, i find my problem is solved.
2/4