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 get signal of button from QListWidgetItem

How to get signal of button from QListWidgetItem

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 4 Posters 367 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
    LISP
    wrote on last edited by
    #1

    How to get signal of button from QListWidgetItem, that was set using setItemWidget?

    I have got listWidget, that contains QListWidgetItem(s).

    On each of them I have got 3 buttons.

    Q. I have to distinguish what button sent the signal in mainwindow.cpp

    JonBJ jsulmJ VRoninV 3 Replies Last reply
    0
    • L LISP

      How to get signal of button from QListWidgetItem, that was set using setItemWidget?

      I have got listWidget, that contains QListWidgetItem(s).

      On each of them I have got 3 buttons.

      Q. I have to distinguish what button sent the signal in mainwindow.cpp

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

      @LISP
      The fact that you added the buttons into a QListWidgetItem with setItemWidget() is neither here nor there. You attach the buttons' signals as you would from anywhere. If you need to know which of the three buttons emitted the signal, or which list item the emitting button was in, it is up to you to pass the information in the connect(), e.g. by using a lambda with a suitable parameter.

      1 Reply Last reply
      1
      • L LISP

        How to get signal of button from QListWidgetItem, that was set using setItemWidget?

        I have got listWidget, that contains QListWidgetItem(s).

        On each of them I have got 3 buttons.

        Q. I have to distinguish what button sent the signal in mainwindow.cpp

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

        @LISP Maybe you should use https://doc.qt.io/qt-5/qbuttongroup.html instead?

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

        1 Reply Last reply
        1
        • L LISP

          How to get signal of button from QListWidgetItem, that was set using setItemWidget?

          I have got listWidget, that contains QListWidgetItem(s).

          On each of them I have got 3 buttons.

          Q. I have to distinguish what button sent the signal in mainwindow.cpp

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          How many items will this QListWidget have, roughly?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          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