How to simplify syntax
-
Lets say, I selected line 1 3 and 9
or I selected lines 1 2 3
I need to 1) select only 123 out of 9 lines total
2) I need to get selected indices :) -
https://justpaste.it/dwq1c
Above is my last working code, it selects rows line by line as requested,
but outputs
Selected columns: QList()
with no inidicesI believe problem in
QList<int> MyWindow::getSelectedColumns()
Need to clarify/fix this syntax -
https://justpaste.it/dwq1c
Above is my last working code, it selects rows line by line as requested,
but outputs
Selected columns: QList()
with no inidicesI believe problem in
QList<int> MyWindow::getSelectedColumns()
Need to clarify/fix this syntax@JacobNovitsky
I'm not sure I follow. If the user selects "lines" (rows) then you won't get any selected columns back? (Because whole columns are not selected, just certain columns within certain rows.) To see which columns are selected within various selected rows use QModelIndexList QItemSelectionModel::selectedIndexes() const, which gives all selected cells and then look at thecolumn()
values within that. If that is what you are looking for. -
@JacobNovitsky
I'm not sure I follow. If the user selects "lines" (rows) then you won't get any selected columns back? (Because whole columns are not selected, just certain columns within certain rows.) To see which columns are selected within various selected rows use QModelIndexList QItemSelectionModel::selectedIndexes() const, which gives all selected cells and then look at thecolumn()
values within that. If that is what you are looking for.@JonB oh, it does indeed outputs columns selected, but I really meant rows :)
So I do look for the same but for rows? -
@JonB oh, it does indeed outputs columns selected, but I really meant rows :)
So I do look for the same but for rows?@JacobNovitsky
Well, yes!
There are 3 methods to see what is selected:selectedColumns()
--- just complete columns selected.selectedRows()
--- just complete rows selectedselectedIndexes()
--- any mix of individual cells (not necessarily contiguous) selected. Always valid. Inspect each item'srow()
andcolumn()
to see what they are, could have any values.
-
-
That walks like a table, quacks like a table and swims like a table. Are you sure you don't actually want to just use
QTableWidget
(orQTableView
+ model if you want to be fancy)? -
@VRonin said in How to simplify syntax:
That walks like a table, quacks like a table and swims like a table
LMAO :D
-
@Pl45m4 It's science: https://en.wikipedia.org/wiki/Duck_test