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. Signal for QListView when the selection changes?
Forum Updated to NodeBB v4.3 + New Features

Signal for QListView when the selection changes?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 5.6k Views 1 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by
    #1

    Is there a similar signal of QListView such as QComboBox::currentIndexChanged()?

    I would like to change other display items depending on which row is currently the active row in a QListView ... or do I have to subclass it? It would be nice if there were a signal I could connect to a slot in my dialog.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      QListView is derived from QAbstractItemView - there are some signals which should help you

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

      R 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        QListView is derived from QAbstractItemView - there are some signals which should help you

        R Offline
        R Offline
        Robert Hairgrove
        wrote on last edited by
        #3

        @Christian-Ehrlicher I looked, but all of the available signals only seem to be emitted when an item is clicked, or otherwise activated ... what I'd like is to have notification when the user navigates the rows up or down by pressing the arrow keys.

        QListWidget offers currentRowChanged, which is exactly what I want ... only this should work for QListView since I have used the model/view design principle here.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #4

          When you want a selection change, you have to connect to the selectionModel().

          btw: please distinguish between current and selected cells - these are two different things!

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

          R 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            When you want a selection change, you have to connect to the selectionModel().

            btw: please distinguish between current and selected cells - these are two different things!

            R Offline
            R Offline
            Robert Hairgrove
            wrote on last edited by
            #5

            @Christian-Ehrlicher Thank you, Christian ... this is exactly what I needed to know.

            I realize that there is a difference between current and selected, but since I have only single selection enabled in the list view, it will do quite nicely.

            (marking as SOLVED)

            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