How to understand Drag and Drop MIME types ?
-
Hello everybody, I am coding a simple window, with two QListWidget's inside. My aim was to be able to drag and drop, elements of the QListWidget from one list to another... I was then wondering about, how I should understand MIME types... I tried to read about it in the documentation, but I am sure, someone explanation could be really interesting for me to better understand the meaning...Thanks in advance.
-
The data of a Drag'n'drop operation is stored in a mime data object. Which types are there defines, ow data could be extracted (text --> text, Url --> file or web adress, image --> picture, ...)
You can also define custom types, so you can store the data in an oüptimal way for your application.
-
you will not drag'n'drop a widget
I think you mean a listWidgetItem, right?There is a description on how to do drag'n'drop, that is (from my POV) good:
- "FAQ: How can I drag and drop in a widget":http://developer.qt.nokia.com/faq/answer/how_can_i_do_drag_and_drop_in_a_widget
- "FAQ: How can I drag from e.g a QListWidget and drop in an editable QTableView?":http://developer.qt.nokia.com/faq/answer/how_can_i_drag_from_e.g_a_qlistwidget_and_drop_in_an_editable_qtableview
- "FAQ: When dragging and dropping between 2 views, how can I perform a move without pressing Shift?":http://developer.qt.nokia.com/faq/answer/when_dragging_and_dropping_between_2_views_how_can_i_perform_a_move_without
- "Wiki: Drag and Drop within a GridView":http://developer.qt.nokia.com/wiki/Drag_and_Drop_within_a_GridView
- "Docs: Drag and drop support in models":http://doc.qt.nokia.com/4.7/model-view-programming.html#drag-and-drop-support-and-mime-type-handling
- "Docs: Drag and Drop Examples":http://doc.qt.nokia.com/4.7/examples-draganddrop.html
These links should give you some ideas.