PDA

View Full Version : Reading info about multiple selected items from a QTableView



andreime
28th July 2009, 15:38
Hello. I am working on an application where i have to list folders and files. I am using a table widget where i list them in rows, while displaying certain info about them in columns.
I am selecting rows as selection behavior and as selection mode Extended Selection.
Each time i click an item i can read information about it. But if i press somewhere and move my mouse selecting multiple elements nothing happens. How ca I make it so i can read each of the items in that selection?
I was thinking of saving the selection in a vector until i make another selection but i cannot read the files under that event. Also i searched for a signal but couldn't find one. Also i thought of using a signal mapper but nothing there.
Please i could use all the help you can give. If anyone has the time to do a more extended reply i would appreciate it.
Thank you very much

franz
28th July 2009, 22:16
If both views are basically QAbstractItemViews, you might want to have a look at QItemSelectionModel and Handling Selections in Item Views (http://doc.trolltech.com/latest/model-view-selection.html).

andreime
30th July 2009, 10:20
The only problem i have is when selecting items with mouse drag. I'm writing into the console the text of the items in the table. When i drag-select items, in the console nothing is printed. i am pretty sure there is a way to read the selected items because it is something that QT implemented as standard with the QTableWidget, but i cannot find that method. If you can point me in the right direction, or explain how this can be achieved i will be greatfull.
Thank you again.