Forum
Sign Up
× DataGrid for Qt.C++

How to drag drop grid row.

6 years 4 months ago - 6 years 4 months ago #1 by Jennifer
I want to drag drop the grid rows.
I have tried following APIs:
view->options().setDragEnabled(true);
view->options().setDropEnabled(true);
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.
Last edit: 6 years 4 months ago by Jennifer.

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago - 6 years 4 months ago #2 by Developer Machines
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.



Attachments:
Last edit: 6 years 4 months ago by Developer Machines.

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #3 by Jennifer
Replied by Jennifer on topic How to drag drop grid row.
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?

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #4 by Jennifer
Replied by Jennifer on topic How to drag drop grid row.
Hi,
Any updates?

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #5 by Developer Machines
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.

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #6 by Jennifer
Replied by Jennifer on topic How to drag drop grid row.
Can I expect to have update which will support row drag-drop/ row movement feature in coming QTitan Data Grid releases?

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.154 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )