PDA

View Full Version : QTableWidget - items selection



trallallero
10th November 2011, 07:27
I would like to permit the user to be in the following situation:

7086

So he understands that he is editing the name of ONE item but he will change the name of all the selected ones (where "enter name" is written).
I've created the situation with the mouse but I cannot do it via software but I guess that, if I can do it with the mouse, it should be possible also via code.

I'm at the point where I have a vector of items that will be selected (QVector<QTableWidgetItem*>) before I call ui->tableWidget->editItem(editItem);
I've tried going through the vector and call

m_ItemsToEdit.at(i)->setSelected(true)
but it doesn't work (it crashes indeed).
I've seen that I should use a selectModel but I cannot find an example...

Somebody knows how to solve the problem ?

trallallero
10th November 2011, 13:03
I have another problem:
how can I sort the QTableWidget by the index 0 (the combobox cells) ?

Added after 26 minutes:

Ok, solved the second problem.
I don't know if there's another way, but I've inserted a QTableWidgetItem where the combox item is, with the same text and the order by works.