Results 1 to 6 of 6

Thread: Drag and Drop from Table View to QWidget

  1. #1
    Join Date
    Oct 2015
    Posts
    18
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Drag and Drop from Table View to QWidget

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drag and Drop from Table View to QWidget

    How. Do the implementations of your drag and drop event handler methods look?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2015
    Posts
    18
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Drag and Drop from Table View to QWidget

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drag and Drop from Table View to QWidget

    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,
    _

  5. #5
    Join Date
    Oct 2015
    Posts
    18
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Drag and Drop from Table View to QWidget

    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 ??

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drag and Drop from Table View to QWidget

    Quote Originally Posted by dikku View Post
    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,
    _

Similar Threads

  1. drag and drop to change order in a table
    By knobby67 in forum Newbie
    Replies: 0
    Last Post: 11th September 2014, 12:57
  2. Drag and Drop With Overlaying QWidget
    By frankiefrank in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2013, 17:22
  3. Replies: 4
    Last Post: 18th April 2012, 19:11
  4. Replies: 1
    Last Post: 7th October 2011, 01:33
  5. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 21:36

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.