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. How to connect signal to slot in Qt Designer?
Qt 6.11 is out! See what's new in the release blog

How to connect signal to slot in Qt Designer?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    ranshalit
    wrote on last edited by A Former User
    #1

    Hello,

    It seems that there are 2 ways to connect signal to slot with Qt designer:

    1. edit->edit signals/slot and the click on widget.
    2. right click on widget -> and choose "go to slot..."

    I am not sure what is the difference between these 2 options.

    Thank you,
    Ran

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      IIRC, number one allows you to connect two compatible signal and slot from widgets directly e.g. a QSpinBox with a QSlider, and number two will send you to the code editor where you'll implement whatever your application needs to do in that slot.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ranshalit
        wrote on last edited by
        #3

        Hi SGaist,

        Thank you!

        As I understand, both method use the signal-slot method (not callbacks or event) , Right ?

        Another think if I may please ask, I tried to see the resulted moc code, but the moc files are missing in project (although they exist in path), Is there some way to include them in project (or shouldn't we do that) ?

        Thanks,
        Ran

        mandruk1331M 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Don't include them in your project.

          These files are generated from your code.

          You can find them in the build folder. They are worth a look if you'd like to understand the internals however I'd recommend reading the woboq blog which has very good articles on several aspects of Qt.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • R ranshalit

            Hi SGaist,

            Thank you!

            As I understand, both method use the signal-slot method (not callbacks or event) , Right ?

            Another think if I may please ask, I tried to see the resulted moc code, but the moc files are missing in project (although they exist in path), Is there some way to include them in project (or shouldn't we do that) ?

            Thanks,
            Ran

            mandruk1331M Offline
            mandruk1331M Offline
            mandruk1331
            wrote on last edited by
            #5

            @ranshalit hello. I'd recommend not to use the signal/slot connection via the designer, it's better to write them yourself so you could get the hang how the signal/slot mechanism works, because in the future you will use them a lot.

            Mandruk1331

            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