Menu QAction double triggered after modal dialog closed
-
Hi,
I tried newest Qt6.8 with MSVC2022 64-bit. Use a menu QAction trigger to open a modal dialog, when the dialog is closed, it will open again, then I need to close it again to actually close it. I traced the code, the QAction slot is invoked twice. Why?
Thanks.
-
@diverger said in Menu QAction double triggered after modal dialog closed:
the QAction slot is invoked twice. Why?
How should we know? Maybe you did something wrong, maybe it's a Qt bug (which I doubt).
Please provide a minimal, compilable example or at least the relevant parts of your code.@Christian-Ehrlicher I omited that Qt may "automatically" connect the signal/slot with slot names. So, besides the one Qt registered for me automatically, I registered another one explicitly. :)
-
Hi,
I tried newest Qt6.8 with MSVC2022 64-bit. Use a menu QAction trigger to open a modal dialog, when the dialog is closed, it will open again, then I need to close it again to actually close it. I traced the code, the QAction slot is invoked twice. Why?
Thanks.
@diverger said in Menu QAction double triggered after modal dialog closed:
the QAction slot is invoked twice. Why?
How should we know? Maybe you did something wrong, maybe it's a Qt bug (which I doubt).
Please provide a minimal, compilable example or at least the relevant parts of your code. -
The first thing I would try to do is find out where the slot that opens the dialog is being called from. So set a breakpoint and see where the slot is being called from.
-
@diverger said in Menu QAction double triggered after modal dialog closed:
the QAction slot is invoked twice. Why?
How should we know? Maybe you did something wrong, maybe it's a Qt bug (which I doubt).
Please provide a minimal, compilable example or at least the relevant parts of your code.@Christian-Ehrlicher I omited that Qt may "automatically" connect the signal/slot with slot names. So, besides the one Qt registered for me automatically, I registered another one explicitly. :)
-
D diverger has marked this topic as solved on
-
Simply rename the slots to something meaningful to disable this stupid auto connection feature.