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. QStandardItem setCheckable(true) & catch any signal when the user click on the checkbox

QStandardItem setCheckable(true) & catch any signal when the user click on the checkbox

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 6.9k 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.
  • D Offline
    D Offline
    derf_r
    wrote on last edited by
    #1

    Hello

    In my QStrandardItemModel I add a column which all the QStandardItem have setCheckable(true).
    When the user click on an checkbox in this column, an signal is emited ?

    I need an signal to connect with my slot

    Best regards
    Frédéric

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ericma
      wrote on last edited by
      #2

      1, when setCheckable(true), the item can be checked by the user; otherwise, the user cannot check the item.
      2, maybe you can try itemChanged as you signal.
      3, also you can use QCheckBox::stateChanged ( int state )
      void QCheckBox::stateChanged ( int state ) [signal]
      This signal is emitted whenever the check box's state changes, i.e. whenever the user checks or unchecks it

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ericma
        wrote on last edited by
        #3

        ..

        1 Reply Last reply
        0
        • D Offline
          D Offline
          derf_r
          wrote on last edited by
          #4

          Helllo
          I know 1)
          I will try 2)
          For 3) how do you know the name of the checkbox in order to connect with the slot ?

          Best Regards
          Frédéric

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Perhaps you can use "QxtListWidget":http://libqxt.bitbucket.org/doc/0.6/qxtlistwidget.html instead? It provides a dedicated signal for this.

            1 Reply Last reply
            0
            • JeroentjehomeJ Offline
              JeroentjehomeJ Offline
              Jeroentjehome
              wrote on last edited by
              #6

              Other idea.
              In the view have the
              @void QAbstractItemView::clicked ( const QModelIndex & index ) [signal]@
              In the model check the column you use for the checkbox from the argumentlist.
              Call your slot as function and you have the same working, but with a small detour.
              So it is more the view then the model that calls the slot you want when a item is clicked.
              Hope this helps a bit.
              greetz

              Greetz, Jeroen

              1 Reply Last reply
              0
              • D Offline
                D Offline
                derf_r
                wrote on last edited by
                #7

                re

                I'll will try first Jeroen idea.
                And after Andre idea, but I don"t have Qxt in my program, and I don't want to add only for an component

                Best regards
                Frédéric

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  derf_r
                  wrote on last edited by
                  #8

                  Hello
                  The solution from Jeroen is perfect for my use.
                  Thanks a lot everybody
                  Best Regards
                  Frédéric

                  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