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. System menu close button(X) pressing interception
Qt 6.11 is out! See what's new in the release blog

System menu close button(X) pressing interception

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.0k 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.
  • I Offline
    I Offline
    ixSci
    wrote on last edited by
    #1

    Hi all!

    I need to distinguish somehow whether the X button was pressed or application is requested to be closed by some other method. I need it because I've overloaded closeEvent() and ignored the event inside. But it prevents an OS from the graceful logout. So I need the method to not close the application by the X button pressing and don't mess with the logout mechanism at the same time. Is there a way to accomplish that in Qt?

    Thank in advance!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      See the QSessionManager and QApplication::commitData documentation. You could set a flag there which will lead your windows to accept the closeEvent.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        See "this thread":http://developer.qt.nokia.com/forums/viewthread/5223 too.

        http://www.catb.org/~esr/faqs/smart-questions.html

        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