Triggering a function every time any messagebox is activated
-
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:
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.
-
@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.
@Dummie1138 There is no such signal. You could create your own wrapper class for dialogs where you can implement what ever you need.
-
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:
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.
@Dummie1138 If you use modal dialogs then the main UI is disabled by default and you do not have to do anything.
-
@Dummie1138 If you use modal dialogs then the main UI is disabled by default and you do not have to do anything.
@jsulm I am aware of this, but I would like to keep the visual effect of a greyout for the user, hence this endeavor.
-
@jsulm I am aware of this, but I would like to keep the visual effect of a greyout for the user, hence this endeavor.
@Dummie1138 Well, you open these dialogs in your app, so you know when a dialog is shown.
-
@Dummie1138 Well, you open these dialogs in your app, so you know when a dialog is shown.
@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.
-
@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.
@Dummie1138 There is no such signal. You could create your own wrapper class for dialogs where you can implement what ever you need.
-
@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.
@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 ofQMessageBox
. 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? -
@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 ofQMessageBox
. 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?@JonB What exactly do you mean when you say "subclass" QMessageBox uses?
-
@JonB What exactly do you mean when you say "subclass" QMessageBox uses?
class MyClass: public QMessageBox