Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    System menu close button(X) pressing interception

    General and Desktop
    3
    3
    2752
    Loading More Posts
    • 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
      ixSci last edited by

      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 Reply Quote 0
      • D
        dangelog last edited by

        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 Reply Quote 0
        • G
          goetz last edited by

          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 Reply Quote 0
          • First post
            Last post