PDA

View Full Version : Drag and Drop from Table View to QWidget



dikku
20th November 2015, 11:58
I want something like, when I Drag from Table View, I want to to Drop it into QWidget. Currently, it not allows me to Drop directly inside the QWidget. If my widget have some content from same Table View priory, than I only able to Drop data inside that content only.

How can i achieve like anywhere in QWidget if i drop something, it will added to my QWidget, without any restriction?

anda_skoa
21st November 2015, 17:13
How. Do the implementations of your drag and drop event handler methods look?

Cheers,
_

dikku
23rd November 2015, 06:47
I have customized TableView() and TableModel()
Now I am using same View and Model, and I able to drag and drop
Here, I want multiple views should be opened in Widget.
Now, When I set some dummy data to Widget, than only I can able to drag something into that view's area.
Not able to drop anywhere in Widget.


for that I am using DropEvent(), which catches the mime data and something like mimedata->data(application/x-absdtractitemmodeldatalist);
from which I get the rows which i want to show by createIndex(), so i get QModelIndex from I db.

anda_skoa
23rd November 2015, 08:37
So do you or do you not have a custom QWidget subclass to which you drag to?

Your original comment suggested that you are dragging from a table view to a custom widget, now it sounds like you are dragging from one table view to another.

If you have reimplemented dragEnterEvent(), dragMoveEvent() or dropEvent(), are those methods being called?

Cheers,
_

dikku
23rd November 2015, 09:17
ohhh... let me tell you the whole workaround...

I am using single model and view for my drag and drop functionality.

Now I have one QWidget, in which I want to have multiple views of table OKay?

Yah, its calling dragEnterEvent(), dragMoveEvent() but not drop event(). It also changes symbol when I drag something in my widget except the place where tableview present in the same widget.

Hope i am ckear to you this time ??

anda_skoa
23rd November 2015, 13:19
Hope i am ckear to you this time ??

Not quite.
You have a container widget which contains multiple table views.
And you want to drag "between" the views, not onto the other views?

Cheers,
_