Important: Please read the Qt Code of Conduct -

Bug with Qt 5.4.1 drag and drop between two QTreeWidgets

  • Hi Everyone,

    I think I might have encountered a bug in Qt 5.4.1, but I'd prefer someone more competent than me would confirm it.

    I was a little bit worried when I converted to 5.4.1, I did skip 5.4 because I read on LXDE blog that he encountered problems with drag and drop here is a quote from his blog:

    Avoid Qt 5.4.0 if possible:
    We encountered several weird regression bugs of Qt 5.4 while debugging LXQt. It breaks drag and drop crossing different programs. With Qt 5.4, >you cannot drag a file from my file manager to other programs, but it’s not my fault. :-)
    (The bug will be fixed in Qt 5.4.1, which is not yet released.)

    The problem is drag and drop between two QTreeWidgets, items created and dragged only in the same widget I think works, but once you drag the items from widget A to widget B, it looses it's children which were in widget A. And also, the items now which were dragged in widget B are glitching a lot.
    Whenever, you try to drag an item into a parent, the last one in the list will disappear no matter what you do, copy, move etc.

    Here is an illustration of what is going on, once you moved items from widget A to widget B:

    DD 1
    DD 2
    DD 3

    I also made a tiny example code which has the bug:

    I've tested that the bug is present when compiling with:
    Qt5.4.1 MSVC2010 OpenGL 32Bit
    Qt5.4.1 MSVC2013 32Bit
    Qt5.4.1 MSVC2013 64Bit
    Qt5.4.1 MSVC2013 OpenGL 64Bit

    There is no bug, when I compiled it on Qt 5.3:
    Qt5.3.0 MSVC2010 OpenGL 32Bit
    Qt5.3.0 MSVC2010 OpenGL 64Bit
    Qt5.3.0 MSVC2013OpenGL 32Bit
    Qt5.3.0 MSVC2013 OpenGL 64Bit

    Could anyone please confirm that this is a bug, and have any suggestions to fix it, or should I just go back to qt 5.3?

    Kind Regards
    Raivis (in old forum "xcoder")