PDA

View Full Version : QTableWidget Sorting Multiple Selection



rhiacasta
3rd July 2006, 15:14
Hi! I have a question on how to move the items up and down from a QTableWidget with multiple slection. I have my sample code below..

int row = mTable->currentRow();
mTable->verticalHeader()->logicalIndex(row);
int indexTo = row - 1;
if (indexTo > 0) {
mTable->verticalHeader()->moveSection(mTable->currentRow(), indexTo);
mTable->setCurrentCell(indexTo, 1);
}

I can move my selecteditem up and down. but when i tried using the QTableWidgetSelectionRange the logicalIndex of my selected Item doesn't changed so the up and down is not working. Have you guys done this before? Thanks!

jpn
30th August 2006, 22:05
This piece of code (http://www.qtcentre.org/forum/p-qtablewidget-move-row-post18492/postcount4.html) should be easy enough to modify to achieve the wanted functionality.