Qt World Summit: Register Today!

(PyQt5 - macOS Sierra) QTreeWidget dragging doesn't behave properly

  • Hello everyone.

    I have created a very simple Window with a QTreeWidget with dragEnabled enabled and some items using Qt 5 Designer. On Kubuntu, dragging and dropping the items orders them correctly, but when running the same program on macOS Sierra, the item below the dragged item gets removed.

    QTreeWidget dragging video on macOS, and the same on Kubuntu.
    The code looks like this, it's pyuic5 generated code without any modifications.

    How can I modify my program to order dragged items correctly? I'm fairly new to Qt/PyQt5, so please excuse me if I'm missing something.

    Thank you very much for your help!

  • Just tested your program on windows 10. No issues there.

  • I tested it within Python 3.7 / PyQt5 / Windows 10 -- as well and it works just fine -- what version of Python are you using that seems to be the biggest culprit that I have seen thus far.

    That said I would not rely on the designer personally because then you do not learn how to make it yourself. Sure look at and see what it is doing but frankly it does not adhere to quality programming standards and creates code that is fairly ugly (aka not simple and smart) and thus it appears more complex than necessary.

    Also you will become dependent upon an additional product that really does not make the design process any easier than it is normally. You would be amazed just how easy it is to build a GUI using the standard code and as you do you will understand what each element is doing more clearly and this could spark an ah-ha moment.

  • Hello,

    The problem is only present in macOS. I have listed Kubuntu as an example of the program working correctly since it's what I use as my main OS. It's good to know that it works on Windows also. Sorry if I wasn't clear enough.

    Thank you.

Log in to reply