Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Question about event->mimeData()->hasFormat(...)



  • Hi,
    I want to know what the QString: "application/x-dnditemdata" means in this block of code (used in a drag-and-drop function): if (event->mimeData()->hasFormat("application/x-dnditemdata"))

    What kind of format is it?
    Thanks for your reply.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I suppose you are looking at the Draggable Icon example. It's just a custom mime-type for the application's drag&drop data.



  • Thanks SGalst , it's clear now,
    I am trying to disable drag-and-drop for just one image(QLabel) and permit it for the others but I d'on't know what to do, the setDraggable(false) option disable it for all of them, I would be pleased if you had some ideas.

    Thank you.


  • Lifetime Qt Champion

    Before starting the drag operation, check that if it's for that specific QLabel and don't do it if it is


Log in to reply