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. QMainWindow Close [SOLVED]

QMainWindow Close [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.3k Views
  • 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.
  • A Offline
    A Offline
    Alterah
    wrote on last edited by
    #1

    Hello,

    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.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      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)...

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alterah
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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 :-)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Alterah
            wrote on last edited by
            #5

            Well, what I had compiled...I just made the stupid mistake of connecting "Open" to close(). That's a bit counterintuitive...I think.

            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