Results 1 to 7 of 7

Thread: QML: Component.onDestruction not calling on window close

  1. #1
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default QML: Component.onDestruction not calling on window close

    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.
    Last edited by nestuser; 18th October 2012 at 06:51.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Component.onDestruction not calling on window close

    CloseEvent() of which widget did you try? And how exactly did you "try" it?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QML: Component.onDestruction not calling on window close

    My sample code is
    Qt Code:
    1. QDeclarativeView* view = new QDeclarativeView();
    2. view->setSource(QUrl::fromLocalFile(filename));
    3. QWidget *widget = new QWidget();
    4. QVBoxLayout *layout = new QVBoxLayout(widget);
    5. layout->addWidget(view);
    6. widget->show();
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void hmi_cfg::closeEvent(QCloseEvent *event)
    2. {
    3. qDebug()<<"Inside close event......."<<event;
    4. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Component.onDestruction not calling on window close

    What is hmi_cfg?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QML: Component.onDestruction not calling on window close

    That is the class name.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML: Component.onDestruction not calling on window close

    Quote Originally Posted by nestuser View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QML: Component.onDestruction not calling on window close

    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..

Similar Threads

  1. Execute event in calling window
    By rdjenner in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2011, 15:28
  2. QTemporaryFile stays locked even after calling close()
    By Tiansen in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2010, 13:35
  3. Replies: 9
    Last Post: 16th May 2010, 16:21
  4. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  5. Calling destructors on close event
    By gyre in forum Newbie
    Replies: 22
    Last Post: 27th November 2007, 19:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.