I want to drag drop the grid rows.
I have tried following APIs:
But it seems like its just copying the cells to dropped position.
Is there any specific API or change required to support moving a entire row to dropped position in grid and not the cells only.
To check drag-drop feature please see DragDropFeature.exe example. It works like other drag providers - creates QMimeData on selected cells or rows and then paste it to the target. To get the target grid determines the location above the cell or the row by the position of the mouse. The place where there will be an attempt to drop the content, is highlighted by arrows. Then you release the mouse all data will be passed to QAbstractItemModel::dropMimeData() of the target.
Please note that compared to the usual QtableView, QtitanDataGrid creates a MimeData that contains application/x-qabstractitemmodeldatalist, plain/text and data in HTML format. This makes it possible to drag the data to other non-Qt targets, for instance into Excel or the mail client.
Thanks For the reply,
I think you did not get my question.
I will elaborate again, I want to implement a feature to drag drop table rows in same grid not to another. Like if select a row 1 and drag it on row 4 then all rows above row 4 should shift up and row 1 should get inserted on top of row 4.
The sample for drag-drop feature is not explaining the required behavior for my case. Please let me know how to do that?
If I understand you correctly, you need to implement the "move" operation inside the grid, right? The grid's model controller does not currently support the move operation, but I think it is possible to delete the rows first and then adding them to a new location.