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. Call function when select a row [SOLVED]

Call function when select a row [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k 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.
  • S Offline
    S Offline
    salvador
    wrote on last edited by
    #1

    Hi,
    i have implemented a grid with the QTableView class. I want to call a specific function when i select a row and and when i do multiple selection (with ctrl pressed) i want to call another function. How can i do tis?

    Thanks!

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      check "QTableView::selectionModel()":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#selectionModel and it's signals

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • S Offline
        S Offline
        salvador
        wrote on last edited by
        #3

        i can't find my solution there. To be more specific when i click a header of my table i emmit "QHeaderView::sectionClicked":http://qt-project.org/doc/qt-4.8/qheaderview.html#sectionClicked
        I want to know how can i make the programm to undestand when i select another row using crtl so i have multiple selection.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          listen to the "selectionChanged signal":http://qt-project.org/doc/qt-4.8/qitemselectionmodel.html#selectionChanged and check selection of rows with "selectedRows":http://qt-project.org/doc/qt-4.8/qitemselectionmodel.html#selectedRows
          Is this enough for you?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • S Offline
            S Offline
            salvador
            wrote on last edited by
            #5

            ok, thanks a lot

            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