I have a simple application, in which I want to fill multiple cells with the same QString at the same time.
My first and innocent try was using 'selectedItems' from QTableWidget, and iterating in the list, using 'setText' for all QWidgetItems of the list.
Turns out that 'selectedItems' does not return empty cells, making it utterly useless to me.
Reading the doc, I was recommended a 'selectedIndexes'.
The problem is: it returns a QModelIndexList. It is a list, all right, but I've got no Idea on how to use the QModelIndex items.
I tried a lot, seriously, and read tons of API (for example: http://doc.trolltech.com/4.0/model-view-selection.html)
Well, my last resort is, as always was, here.
And you guys always help!
my last trying code (after many others...) was:
Qt Code:
QModelIndexList itemsList = selectionModel->selectedIndexes(); QModelIndex item; foreach(item, listaItens) { item.model()->setData(item, ui->lineEdit->text()); }To copy to clipboard, switch view to plain text mode
Thank you already!
Bookmarks