Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to link exit menu to the mainwindow's destructor
Forum Updated to NodeBB v4.3 + New Features

How to link exit menu to the mainwindow's destructor

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thomas11live.com.sg
    wrote on last edited by
    #1

    Dear All,
    When we close the main window with the close button (located at the top left corner), the main window's destructor is called.
    I like to make an exit menu, and how that exit menu can be linked to the main window's destructor, so that when exit menu is selected,
    ui is deleted and main window is closed.
    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      You can't "link" it to destructor. Use separate slot for that, call "deleteLater":http://qt-project.org/doc/qt-4.8/qobject.html#deleteLater on window, and close it... Or reimplement "closeEvent":http://qt-project.org/doc/qt-4.8/qwidget.html#closeEvent to do needed cleanups.

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved