Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-26229

The drag action NOT aborted even if QStandardItemModel::dropMimeData() returns false.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • 4.8.2, 4.8.4
    • GUI: Drag and Drop
    • I am running on Windows 7 Professional, SP1, 64-bit.
      MS Visual Studio 2008 Version 9.0.30729.1 SP (C++)

      I derived a model from QStandardItemModel that I wanted to use with Drag and Drop and I am using it in a QTreeView. In my over-ridden dropMimeData method, I only want to allow the drops to take place if I have a valid parent object. (I.e. NOT allow drops on the top level of the tree).

      I assumed returning false from this method would abort the drag and the drop, but that is not the case. If I return false, the DROP is not done, but the item being DRAGGED is still removed from the model.

      I have attached a small test program that shows the issue. If you build it and then try to drag an item out of the treeView and drop it onto some empty space at the bottom of the treeView, the item will not be dropped anywhere, but WILL be removed from the model.

        1. DropMimeBug.cpp
          1 kB
          Wayne Davies
        2. DropMimeBug.h
          0.4 kB
          Wayne Davies
        3. DropMimeBug.sln
          0.9 kB
          Wayne Davies
        4. DropMimeBug.ui
          1 kB
          Wayne Davies
        5. DropMimeBug.vcproj
          13 kB
          Wayne Davies
        6. MyModel.cpp
          1 kB
          Wayne Davies
        7. MyModel.h
          0.3 kB
          Wayne Davies
        8. main.cpp
          0.2 kB
          Wayne Davies
        9. stdafx.cpp
          0.0 kB
          Wayne Davies
        10. stdafx.h
          0.0 kB
          Wayne Davies
        11. dragdroptest_v2.zip
          4 kB
          Leonard Lee
        12. dragdroptest_v2_steps_recorded.zip
          108 kB
          Leonard Lee
        For Gerrit Dashboard: QTBUG-26229
        # Subject Branch Project Status CR V

            liaqi Liang Qi
            scumpyt Wayne Davies
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes