Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Question about QAbstractItemModel::canDropMimeData()
Qt 6.11 is out! See what's new in the release blog

Question about QAbstractItemModel::canDropMimeData()

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on last edited by Robert Hairgrove
    #1

    In my custom model's implementation of dropMimeData():

    Do I need to call canDropMimeData() myself before proceeding with the actual implementation, or can I assume that the underlying framework has already called this before it calls dropMimeData()?

    My custom model has its own implementation of canDropMimeData().

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      canDropMimeData() is there to see if a drop can occour - if it returns false dropMimeData() will not be called (otherwise canDropMimeData() would be useless).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      R 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        canDropMimeData() is there to see if a drop can occour - if it returns false dropMimeData() will not be called (otherwise canDropMimeData() would be useless).

        R Offline
        R Offline
        Robert Hairgrove
        wrote on last edited by
        #3

        @christian-ehrlicher : Thanks for the clear explanation. It is logical that the framework would call this function at some point. But I could not find any place in the Qt source code where QTableView or one of the other item view classes actually calls this. Can anyone please point it out?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's the base class which is calling the function. See https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qabstractitemview_p.h.html#_ZN24QAbstractItemViewPrivate7canDropEP10QDropEvent

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          R 2 Replies Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            It's the base class which is calling the function. See https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qabstractitemview_p.h.html#_ZN24QAbstractItemViewPrivate7canDropEP10QDropEvent

            R Offline
            R Offline
            Robert Hairgrove
            wrote on last edited by
            #5

            @christian-ehrlicher : Excellent ... thank you!

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              It's the base class which is calling the function. See https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qabstractitemview_p.h.html#_ZN24QAbstractItemViewPrivate7canDropEP10QDropEvent

              R Offline
              R Offline
              Robert Hairgrove
              wrote on last edited by
              #6

              @christian-ehrlicher : And thanks for the link to the fantastic woboq.org site which was new to me. All the sources are hyperlinked, so it is very easy to navigate!

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved