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. Slot are not defined but works fine even without connection to signal
Qt 6.11 is out! See what's new in the release blog

Slot are not defined but works fine even without connection to signal

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 657 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.
  • L Offline
    L Offline
    Lisun
    wrote on last edited by
    #1

    Hello,

    I have no serious Qt programming experience. I made a form based on QDialog, in which I have QDialogButtonBox. In order for the form to respond to pressing the "OK" button of class QDialogButtonBox, in theory, you need to connect an "accepted" QDialogButtonBox class signal to an "my_slot" QDialog class slot. However, since there was very little experience, I googled every step or read the documentation to complete the task. As a result, I implemented it in way I can not find the information now where I found such a solution, but the solution is good.

    Object name of My QDialogButtonBox is "Login"
    In class QDialog, i added slot -on_Login_accepted().
    That is all. I not made any connection of this slot to any signals and all works fine. I just named my slot : on_(name of my object)_accepted()
    and it works. Connection was made automatically.

    Could anybody explain or better give link to where i can read about it, please.

    P.S. Sorry for my English if somesing wrong. I hope you understand me)

    JonBJ 1 Reply Last reply
    0
    • L Lisun

      Hello,

      I have no serious Qt programming experience. I made a form based on QDialog, in which I have QDialogButtonBox. In order for the form to respond to pressing the "OK" button of class QDialogButtonBox, in theory, you need to connect an "accepted" QDialogButtonBox class signal to an "my_slot" QDialog class slot. However, since there was very little experience, I googled every step or read the documentation to complete the task. As a result, I implemented it in way I can not find the information now where I found such a solution, but the solution is good.

      Object name of My QDialogButtonBox is "Login"
      In class QDialog, i added slot -on_Login_accepted().
      That is all. I not made any connection of this slot to any signals and all works fine. I just named my slot : on_(name of my object)_accepted()
      and it works. Connection was made automatically.

      Could anybody explain or better give link to where i can read about it, please.

      P.S. Sorry for my English if somesing wrong. I hope you understand me)

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @Lisun
      It is because of the actual name you (Qt Creator) chose for the slot, on_Login_accepted(), which is of the form void on_<object name>_<signal name>. See https://doc.qt.io/qt-5/designer-using-a-ui-file.html#widgets-and-dialogs-with-auto-connect. Some people choose to do it this way automatically, some prefer to use a different name for the slot and do the connect()s explicitly/manually.

      L 1 Reply Last reply
      5
      • JonBJ JonB

        @Lisun
        It is because of the actual name you (Qt Creator) chose for the slot, on_Login_accepted(), which is of the form void on_<object name>_<signal name>. See https://doc.qt.io/qt-5/designer-using-a-ui-file.html#widgets-and-dialogs-with-auto-connect. Some people choose to do it this way automatically, some prefer to use a different name for the slot and do the connect()s explicitly/manually.

        L Offline
        L Offline
        Lisun
        wrote on last edited by
        #3

        @JonB Thanks a lot for quick response

        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