Results 1 to 2 of 2

Thread: Why QAbstractItemView::dragEnterEvent is always accepted?

  1. #1
    Join Date
    May 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Why QAbstractItemView::dragEnterEvent is always accepted?

    Why QAbstractItemView::dragEnterEvent doesn't​ check model's canDropMimeData method? This results in incorrect 1-pixel area along widget boundary which is always "positive-drop" without taking into account if model can actually accept data. Is there any workaround?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Why QAbstractItemView::dragEnterEvent is always accepted?

    The docs say:
    This function is called with the given event when a drag and drop operation enters the widget. If the drag is over a valid dropping place (e.g. over an item that accepts drops), the event is accepted; otherwise it is ignored.
    So, it seems to me its not checking the model's canDropMimeData() since it is going even lower, it asks the item over which the event happens.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 0
    Last Post: 2nd March 2015, 12:39
  2. Qt::Accepted in Qt 5.0
    By Higgs in forum Newbie
    Replies: 2
    Last Post: 14th February 2014, 17:41
  3. How to be notified on dragEnterEvent?
    By tuxit in forum Qt Quick
    Replies: 6
    Last Post: 12th August 2011, 13:29
  4. Not getting dragEnterEvent - sometimes
    By derekn in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2009, 07:41

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.