PDA

View Full Version : QTableWidget - D&D



GrahamLabdon
26th May 2011, 11:59
Hello
I have used Qt Designer to make a dialog containing a QTableWidget.
I have set the following - so that I can drag and drop rows within the table


tableWidget->setAcceptDrops(true);
tableWidget->setDragEnabled(true);
tableWidget->setDefaultDropAction(Qt::MoveAction);
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows );


However I cannot drag rows within the table

What have I missed

TIA

Graham

high_flyer
27th May 2011, 09:48
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
This tells the table that no items can be selected.
So if they can't be selected, how can they be dragged?