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. ui detect mouse event on objects
Forum Updated to NodeBB v4.3 + New Features

ui detect mouse event on objects

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 6 Posters 3.1k Views 2 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.
  • P Pfanne

    @JonB
    the first version:

    connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
    

    is without the object ID, implementing the ID in this version a error occurse.

    M Offline
    M Offline
    mpergand
    wrote on last edited by
    #21

    @Pfanne said in ui detect mouse event on objects:

    connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);

    As I said earlier, you have to pass an address:

    connect(ioGroup, &QButtonGroup::idClicked, this, &MainWindow::on_ioGroup_clicked);

    1 Reply Last reply
    2
    • JonBJ JonB

      @mpergand said in ui detect mouse event on objects:

      &MainWindow::on_ioGroup_clicked);

      OIC I missed that when OP said it was correct.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #22

      @Pfanne

      @JonB said in ui detect mouse event on objects:

      @mpergand said in ui detect mouse event on objects:

      &MainWindow::on_ioGroup_clicked);

      OIC I missed that when OP said it was correct.

      You can see for yourself (when it's written in monospace) that in your
      connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);

      one method reference has a preceding & and the other does not, and thereby tell what you had is not correct.

      P 1 Reply Last reply
      0
      • JonBJ JonB

        @Pfanne

        @JonB said in ui detect mouse event on objects:

        @mpergand said in ui detect mouse event on objects:

        &MainWindow::on_ioGroup_clicked);

        OIC I missed that when OP said it was correct.

        You can see for yourself (when it's written in monospace) that in your
        connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);

        one method reference has a preceding & and the other does not, and thereby tell what you had is not correct.

        P Offline
        P Offline
        Pfanne
        wrote on last edited by
        #23

        @JonB

        connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
        

        OK, I think I understand, but this try worked, without ID but it creates a event on every click.
        Without the reference (&) to MainWindow....

        But it´s OK, this try:

        connect(ioGroup, SIGNAL(idClicked(int)), this, SLOT(on_ioGroup_clicked(int)));
        

        is exactly the way that I use (SIGNAL -> SLOT) for my other connections.

        Thanks for your support!

        Christian EhrlicherC 1 Reply Last reply
        0
        • P Pfanne

          @JonB

          connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
          

          OK, I think I understand, but this try worked, without ID but it creates a event on every click.
          Without the reference (&) to MainWindow....

          But it´s OK, this try:

          connect(ioGroup, SIGNAL(idClicked(int)), this, SLOT(on_ioGroup_clicked(int)));
          

          is exactly the way that I use (SIGNAL -> SLOT) for my other connections.

          Thanks for your support!

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #24

          @Pfanne said in ui detect mouse event on objects:

          is exactly the way that I use (SIGNAL -> SLOT) for my other connections.

          But you should switch to the pmf syntax for your own sake.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          P 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @Pfanne said in ui detect mouse event on objects:

            is exactly the way that I use (SIGNAL -> SLOT) for my other connections.

            But you should switch to the pmf syntax for your own sake.

            P Offline
            P Offline
            Pfanne
            wrote on last edited by
            #25

            @Christian-Ehrlicher

            should I use the pmf syntax only for object events or also for function events too?

            Pl45m4P 1 Reply Last reply
            0
            • P Pfanne

              @Christian-Ehrlicher

              should I use the pmf syntax only for object events or also for function events too?

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #26

              @Pfanne

              What are object or function events from your perspective?
              You can't connect events, you connect signals there.
              And yes, use the function pointer connection style. Every time you make a signal connection


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              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