[Solved]closeEvent() is not working when application is closing.
-
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. -
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. -
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.
-
mlong, thank you. QCoreApplication::aboutToQuit helped me.
Even if i could not find why closeEvent is not working, i find my problem is solved.