PDA

View Full Version : QTable : rowMovingEnabled and swapRows



greencastor
1st August 2006, 17:29
Hello !

I use somme QTable and I would like to swap rows. For the moment, I have created a slot that uses swapRows(int, int) but I would prefer to use the property "rowMovingEnabled", which allows the user to move row while pressing "Ctrl" and clicking on the header's row. The problem is that I found no signals that would allow me to catch it and make the treatment I would like to do.

Any suggestions ? :confused:

jacek
1st August 2006, 17:39
How about this?
void QHeaderView::sectionMoved ( int logicalIndex, int oldVisualIndex, int newVisualIndex ) [signal]
This signal is emitted when a section is moved. The section's logical index is specified by logicalIndex, the old index by oldVisualIndex, and the new index position by newVisualIndex.
See also moveSection().

greencastor
2nd August 2006, 09:25
I forgot to say that this time I use Qt3... Sorry :(

But you are right, I didn't think about using the QHeader class. I have now tried with the signal "QHeader::indexChange ( int, int, int )" and it has worked !
Thank you, jacek!