PDA

View Full Version : QTableWidget - Selection and Drag and drop



mohaskh
29th December 2015, 18:00
Hello everyone !

I'm french, sorry if my english language is not very good.
I would like to know if there is a method to select cells of QTableWidget and then drag and drop its.
The problem is that if we allow the selection, we cannot use drag and drop and if we allow the drag and drop function, the selection doesn't work.

So, i would like to add a small shape (if it is possible) on the bottom right corner for all cells that permit to select cells on mouse pressed button like excel and if we press mouse button on the cells, it is the drag and drop enabled.

Thanks

Mohaskh

prasad_N
31st December 2015, 05:54
tableWidget->setDragDropMode(QAbstractItemView::DragDrop); allows you to do both select multiple cells/rows & drag them

check QAbstractItemView::DragDropMode for other flags.

mohaskh
31st December 2015, 13:45
Thanks for your response.
I tried to use this method but i cannot select cells and rows.

With :
tableWidget->setDragDropMode(QAbstractItemView::DragDrop);
I can drag and drop only one item and i want to drag and drop a list of items after selecting them with the mouse.

Thanks ;)

prasad_N
31st December 2015, 19:07
you need to use CTRL for multiple selection & SHIFT for bulk selection.