Unsolved facilitating multiple selections from a QTableView
-
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...
-
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
-
@mzimmers
Since you're usingQTableView
, 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.
-
@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...
-
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.