Results 1 to 17 of 17

Thread: Drag and Drop problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Drag and Drop problem

    Quote Originally Posted by ScoOteR View Post
    Re: Drag and Drop problem
    I've tried something else. I've made a simple model which holds some static data and made another widget for it the drop was enabled over this one. Even though both have the same custom table view and custom header and both models implements mimeType. So, what do u think made it work with one model and not the other !!!!!!!!!!!!!!!!!!!!!1
    Was the "another widget" a headerview as well?

    Re: Drag and Drop problem
    actually I've a new surprise for u all. On debugging I found that it stops @ the break point in the mimeType of my temp small model. and i doesn't in the other model I've been working with for a while. So, I'd really appreciate if any body told me what the heck on earth could make what's happening here make sense !!!!
    mimeTypes() just lists what types are produced by the model, it's not important for drops. You have to check whether drop actions are enabled over the place you want to drop on. The difference in behaviour between "two models" could be caused by a different implementation of the flags() method.

    AFAIR normally a model doesn't differenciate between a drop on the header and "outside any item", so if you want to actually make a drop on the header, you have to hack the view (remember that headers are not part of the model).

    For instance, if you return ItemIsDropEnabled from flags() for an invalid index, you'll be able to perform a drop directly on the view (and not on any of its items). But this won't be a drop on the header itself - you'll be able to drop anywhere in the view. I thought you wanted to drop on the header explicitely.

    sorry but i think u've missed those to comments which I've posted early.
    I haven't missed them, I just thought they didn't carry any relevant information.

  2. #2
    Join Date
    Nov 2006
    Posts
    15

    Default Re: Drag and Drop problem

    for your first question yes it had a headerview.

    in both cases i used the same custom control I've made. So, what do u think might have caused this problem ?!

  3. #3
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drag and Drop problem

    Hello all,

    I am using QTableView with Qt4.6 and I have the same issue with Drop on QHeaderView.

    I have Drag & drop working nicely on the table but not on the header. I have created a new class that is based on QHeaderView and that implement the dragEnterEvent, dragMoveEvent, dropEvent.
    Of course I have setAcceptDrops(true).
    None of the the implemented event is called, and dropping data to the header is impossible...

    What I would like to do is to enable drag&drop for a complete line, by using the header.

    Does anyone have any idea or hint ?

    Thanks in advance

    kpa

  4. #4
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drag and Drop problem

    Finally it was only a bad validity check in dragEnterEvent

Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 20:36
  2. Replies: 7
    Last Post: 8th September 2006, 16:19
  3. Drag and drop outside the application
    By jpn in forum Newbie
    Replies: 7
    Last Post: 27th August 2006, 15:37
  4. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41
  5. Drag 'n Drop problem
    By kiker99 in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2006, 16:35

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
  •  
Qt is a trademark of The Qt Company.