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. facilitating multiple selections from a QTableView
Qt 6.11 is out! See what's new in the release blog

facilitating multiple selections from a QTableView

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 4 Posters 2.7k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    The app I'm working on has a QTableView. Each row represents a remote device that the app can "see."

    Users have asked for the ability to do "mass" (their word) operations, like firmware updates. I'm sure that they'll want to select some devices in the view, but exclude others, so I'm looking at ways to make this easier. They can do the click, shift-click and ctrl-click but I'm thinking that something like checkboxes would be nicer.

    I've done some searching on using checkboxes with QTableView, and all the results I've found are surprisingly old. So, I'm curious as to what people think about 1) whether this is a good way to go, 2) a good method of implementation.

    These selections will probably be used with QtConcurrent (but that's for another day).

    Thanks...

    JonBJ 1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      Not quite the same but I had to implement selection for QML TableView working with my QAbstractTableModel w/ QSortFilterProxyModel(s) on top instanced by TableView.

      I'm not sure how widgets land is but I'd (did) start looking at: https://doc.qt.io/qt-5/model-view-programming.html#handling-selections-of-items

      1 Reply Last reply
      0
      • mzimmersM mzimmers

        Hi all -

        The app I'm working on has a QTableView. Each row represents a remote device that the app can "see."

        Users have asked for the ability to do "mass" (their word) operations, like firmware updates. I'm sure that they'll want to select some devices in the view, but exclude others, so I'm looking at ways to make this easier. They can do the click, shift-click and ctrl-click but I'm thinking that something like checkboxes would be nicer.

        I've done some searching on using checkboxes with QTableView, and all the results I've found are surprisingly old. So, I'm curious as to what people think about 1) whether this is a good way to go, 2) a good method of implementation.

        These selections will probably be used with QtConcurrent (but that's for another day).

        Thanks...

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

        @mzimmers
        Since you're using QTableView, does each row have more than the one column of the device name?

        Assuming so, I presume they only want to select complete rows, not individual cells?

        So you could either do it by making, say, just the device name items checkable to represent the whole row, or by having an extra first column of checkboxes.

        Would this be any easier than the standard click-selecting options? I don't really see why, but maybe it would be.

        Trying to make "life easier" sounds like a recipe for user-whinging ;-)

        If this is an issue, it sounds like you have a lot of rows for the user to select from for a mass operation? Say hundreds. In that case, would users benefit from the ability to do selection by "search-filtering"? Like an external text edit, type in part of a device name or other column/criteria and click key to cause all matching rows to be added (or removed) to those currently selected, and keep doing that. I have used app which allowed that when selecting from a list of hundreds/thousands of virtual devices attached to a Windows box to kill them, it was quite useful.

        mzimmersM 1 Reply Last reply
        2
        • JonBJ JonB

          @mzimmers
          Since you're using QTableView, does each row have more than the one column of the device name?

          Assuming so, I presume they only want to select complete rows, not individual cells?

          So you could either do it by making, say, just the device name items checkable to represent the whole row, or by having an extra first column of checkboxes.

          Would this be any easier than the standard click-selecting options? I don't really see why, but maybe it would be.

          Trying to make "life easier" sounds like a recipe for user-whinging ;-)

          If this is an issue, it sounds like you have a lot of rows for the user to select from for a mass operation? Say hundreds. In that case, would users benefit from the ability to do selection by "search-filtering"? Like an external text edit, type in part of a device name or other column/criteria and click key to cause all matching rows to be added (or removed) to those currently selected, and keep doing that. I have used app which allowed that when selecting from a list of hundreds/thousands of virtual devices attached to a Windows box to kill them, it was quite useful.

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #4

          @JonB yes, I display several columns, but only an entire row is to be selected.

          You might be right that using the click selection is adequate. I'm just exploring alternatives.

          I don't really have an answer for how many rows the view will display, but it's feasible that for some larger customers, it could be in the hundreds. I'll take a closer look at Qt's options for search-filtering.

          Thanks...

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            @JonB suggestion is good. You have your table on the left and then on the right you can have a list. Your users can then move stuff from left to right an the operations you want will be applied to the list on the right.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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