QMainWindow Close [SOLVED]
I am sure the answer to this is somewhere but I cannot seem to locate it. I am currently playing around with Qt and trying to connect a menu bar action "close" to the slot "close()." However, when I do this, I get no error messages. My GUI displays, but selecting Close in the menu does nothing. I am doing the connecting in the constructor of the QMainWindow. I can create a button and connect it to the close() slot and that works. And, I can, of course, use the red X to close my GUI as well. Is there something unique about the menu bar that might cause this? I can definitely post my code, but I simply copied the connect from the QAction to my QPushButton, changed the name and changed triggered() to clicked(). So, I assume the problem lies in how triggered events are handled vs clicked events. Thanks for any advice. I apologize if this exact question has been asked before. I did a quick search but nothing popped out as addressing this particular issue.
please post your not working code.
there is no difference in how signals are triggered. Wheny they are emitted, they will reach the target (if connected).
The X in the title bar goes another way, via the system events, but there should be no difference between the button and the action (if the action is really triggered)...
I would post my code, but in the process of stripping down the extras from the close so you could see the problem easier, I discovered an embarrassing mistake I had made. Long story short, it helps to connect the signal and slot to the right action.
And that is one of the main reasons why you are asked to strip your problem down to a compilable example in the first place :-)
Well, what I had compiled...I just made the stupid mistake of connecting "Open" to close(). That's a bit counterintuitive...I think.