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 use signals and slots mechanism between different classes ?

How to use signals and slots mechanism between different classes ?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 666 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.
  • Q Offline
    Q Offline
    QtVik
    wrote on last edited by
    #1

    Hi,

    Scenario:
    I have a mainwindow class which has a method to launch QDialog.
    Another class which is plugin class that has QButton.
    Now if I press button in plugin class then it should invoke the method of mainwindow class.

    How to achieve that using signals and slots mechanism between these two classes ?
    An example code will really help me.

    Thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • Ebizz InfotechE Offline
      Ebizz InfotechE Offline
      Ebizz Infotech
      Banned
      wrote on last edited by Ebizz Infotech
      #2
      This post is deleted!
      1 Reply Last reply
      -1
      • Q QtVik

        Hi,

        Scenario:
        I have a mainwindow class which has a method to launch QDialog.
        Another class which is plugin class that has QButton.
        Now if I press button in plugin class then it should invoke the method of mainwindow class.

        How to achieve that using signals and slots mechanism between these two classes ?
        An example code will really help me.

        Thanks in advance.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @QtVik Did you read https://doc.qt.io/qt-5/signalsandslots.html ?
        It is actually quite simple:

        MainWindow::MainWindow(...)
        {
            connect(pluginClass, &PlugInClass::signal, this, MainWindow::slot);
         }
        

        Please explain what exactly is not clear/not working.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply
        2
        • jsulmJ jsulm

          @QtVik Did you read https://doc.qt.io/qt-5/signalsandslots.html ?
          It is actually quite simple:

          MainWindow::MainWindow(...)
          {
              connect(pluginClass, &PlugInClass::signal, this, MainWindow::slot);
           }
          

          Please explain what exactly is not clear/not working.

          Q Offline
          Q Offline
          QtVik
          wrote on last edited by
          #4

          @jsulm Could you please share the detailed sample code how to do that ?

          jsulmJ 1 Reply Last reply
          0
          • Q QtVik

            @jsulm Could you please share the detailed sample code how to do that ?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @QtVik Did you actually read the documentation I gave you?
            There are examples.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Q 1 Reply Last reply
            4
            • jsulmJ jsulm

              @QtVik Did you actually read the documentation I gave you?
              There are examples.

              Q Offline
              Q Offline
              QtVik
              wrote on last edited by
              #6

              @jsulm Thank you. I have read the documentation.

              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