PDA

View Full Version : QML: Component.onDestruction not calling on window close



nestuser
18th October 2012, 06:22
Hi,

I loaded a QML file using QDeclarativeview and continuously send some signals to the Qml file from cpp.
On window close of the qml file i need to stop the the signals. But how can I identify the window close of qml file?? I tried Component.onDestruction event of qml. But it is not getting. Please suggest a suitable method.
I tried closeEvent(). But this is also not hitting...

Thanks in advance.

wysota
18th October 2012, 07:45
CloseEvent() of which widget did you try? And how exactly did you "try" it?

nestuser
18th October 2012, 09:04
My sample code is


QDeclarativeView* view = new QDeclarativeView();
view->setSource(QUrl::fromLocalFile(filename));
QWidget *widget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout(widget);
layout->addWidget(view);
widget->show();




void hmi_cfg::closeEvent(QCloseEvent *event)
{
qDebug()<<"Inside close event......."<<event;
}

wysota
18th October 2012, 12:09
What is hmi_cfg?

nestuser
19th October 2012, 05:11
That is the class name.

wysota
19th October 2012, 08:46
That is the class name.

Yes, I'm aware of that. I'm asking what this class is. Is this your top-level widget or some other widget or what exactly.

nestuser
22nd October 2012, 14:09
Sorry, that was my mistake.
hmi_cfg was a subclass of QDeclarativeView.
I re implemented it as a subclass of QWidget, then I got the QCloseEvent correctly..

Thanks for your help.. :)