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 do something before the user close the window?
Qt 6.11 is out! See what's new in the release blog

how do something before the user close the window?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 1.6k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I want to do something before the user close the window
    not when the whole application get closed
    how to do that?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Re-implement the closeEvent method as shown in the documentation.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Looks very close to this thread.

        Please don't ask the same question several times.

        If you made a mistake on the title or the question text, you can edit it rather than re-ask the exact same stuff with just minor corrections.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        ? 1 Reply Last reply
        1
        • SGaistS SGaist

          Looks very close to this thread.

          Please don't ask the same question several times.

          If you made a mistake on the title or the question text, you can edit it rather than re-ask the exact same stuff with just minor corrections.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @SGaist but i removed it how it's still available

          JonBJ 1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You just deleted the post not the topic.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • ? A Former User

              @SGaist but i removed it how it's still available

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #6

              @davidlabib
              Thanks for removing it after I posted an answer....

              ? 1 Reply Last reply
              0
              • JonBJ JonB

                @davidlabib
                Thanks for removing it after I posted an answer....

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @JonB no no this is not what you are thinking
                i deleted it because it had a lot of mistakes
                I hope you understand

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @JonB @SGaist
                  Error
                  0_1534370778681_42a2652c-919c-4848-92f2-9008842da19f-image.png

                  0_1534370813606_0c3d2957-ec68-47e3-a85e-9ee023a771ee-image.png

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Did you declare that function in your header ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    ? 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Did you declare that function in your header ?

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #10

                      @SGaist Yes i did
                      0_1534371083238_7c6c85d6-7e7b-4eef-83b2-3694ad858061-image.png

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        As the error suggest, both signatures don't match. In your header you pass a QCloseEvent object, while the original and correct signature is to pass a pointer to a QCloseEvent object.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #12

                          i got it , thanks a lot
                          @JonB and again I'm Apologizing about deleting the topic but it had a lot of mistakes
                          i thought that deleting it and make a new one is better

                          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