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. Triggering a function every time any messagebox is activated
Forum Updated to NodeBB v4.3 + New Features

Triggering a function every time any messagebox is activated

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 436 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.
  • Dummie1138D Offline
    Dummie1138D Offline
    Dummie1138
    wrote on last edited by Dummie1138
    #1

    Hi. I would like to know whether there is a signal that is activated any time a QMessagebox is activated. The reason why I want this is because I want to grey out the main window every time any QMessageboxes are activated. Something like this:

    ca3bfc55-873a-4ac8-98c9-fae8a3250400-image.png

    I would like to know whether such a signal exists such that I can preemptively grey out the main window before any QMessageboxes, or do I have to manually run the function before a QMessagebox activation.

    jsulmJ 1 Reply Last reply
    0
    • Dummie1138D Dummie1138

      @jsulm Yes, I do personally know when the QMsgbox is triggered and right now I'm doing this by manually adding the function before the messagebox is triggered/turned off. However, I want to automate this process by having the code read whatever signal (if any) is activated when the Msgbox triggers. Hence, I wanna know whether such a signal that activates when Msgbox triggers exists.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Dummie1138 There is no such signal. You could create your own wrapper class for dialogs where you can implement what ever you need.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • Dummie1138D Dummie1138

        Hi. I would like to know whether there is a signal that is activated any time a QMessagebox is activated. The reason why I want this is because I want to grey out the main window every time any QMessageboxes are activated. Something like this:

        ca3bfc55-873a-4ac8-98c9-fae8a3250400-image.png

        I would like to know whether such a signal exists such that I can preemptively grey out the main window before any QMessageboxes, or do I have to manually run the function before a QMessagebox activation.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Dummie1138 If you use modal dialogs then the main UI is disabled by default and you do not have to do anything.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Dummie1138D 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Dummie1138 If you use modal dialogs then the main UI is disabled by default and you do not have to do anything.

          Dummie1138D Offline
          Dummie1138D Offline
          Dummie1138
          wrote on last edited by
          #3

          @jsulm I am aware of this, but I would like to keep the visual effect of a greyout for the user, hence this endeavor.

          jsulmJ 1 Reply Last reply
          0
          • Dummie1138D Dummie1138

            @jsulm I am aware of this, but I would like to keep the visual effect of a greyout for the user, hence this endeavor.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Dummie1138 Well, you open these dialogs in your app, so you know when a dialog is shown.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Dummie1138D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Dummie1138 Well, you open these dialogs in your app, so you know when a dialog is shown.

              Dummie1138D Offline
              Dummie1138D Offline
              Dummie1138
              wrote on last edited by
              #5

              @jsulm Yes, I do personally know when the QMsgbox is triggered and right now I'm doing this by manually adding the function before the messagebox is triggered/turned off. However, I want to automate this process by having the code read whatever signal (if any) is activated when the Msgbox triggers. Hence, I wanna know whether such a signal that activates when Msgbox triggers exists.

              jsulmJ JonBJ 2 Replies Last reply
              0
              • Dummie1138D Dummie1138

                @jsulm Yes, I do personally know when the QMsgbox is triggered and right now I'm doing this by manually adding the function before the messagebox is triggered/turned off. However, I want to automate this process by having the code read whatever signal (if any) is activated when the Msgbox triggers. Hence, I wanna know whether such a signal that activates when Msgbox triggers exists.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Dummie1138 There is no such signal. You could create your own wrapper class for dialogs where you can implement what ever you need.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • Dummie1138D Dummie1138

                  @jsulm Yes, I do personally know when the QMsgbox is triggered and right now I'm doing this by manually adding the function before the messagebox is triggered/turned off. However, I want to automate this process by having the code read whatever signal (if any) is activated when the Msgbox triggers. Hence, I wanna know whether such a signal that activates when Msgbox triggers exists.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #7

                  @Dummie1138
                  As @jsulm has written, there is no auto-generated signal emitted when a window or dialog is opened. You can create your own wrapper like he says, or you could subclass your uses of QMessageBox. If you don't want to do either of these, I have not checked but if you place an eventFilter on, say, the application object you might get to see a QShowEvent when such a box is shown which you could act on?

                  Dummie1138D 1 Reply Last reply
                  1
                  • JonBJ JonB

                    @Dummie1138
                    As @jsulm has written, there is no auto-generated signal emitted when a window or dialog is opened. You can create your own wrapper like he says, or you could subclass your uses of QMessageBox. If you don't want to do either of these, I have not checked but if you place an eventFilter on, say, the application object you might get to see a QShowEvent when such a box is shown which you could act on?

                    Dummie1138D Offline
                    Dummie1138D Offline
                    Dummie1138
                    wrote on last edited by
                    #8

                    @JonB What exactly do you mean when you say "subclass" QMessageBox uses?

                    jsulmJ 1 Reply Last reply
                    0
                    • Dummie1138D Dummie1138

                      @JonB What exactly do you mean when you say "subclass" QMessageBox uses?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @Dummie1138

                      class MyClass: public QMessageBox
                      

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1

                      • Login

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