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. Change icon of a drag and drop event
Forum Updated to NodeBB v4.3 + New Features

Change icon of a drag and drop event

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k 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.
  • napajejenunedk0N Offline
    napajejenunedk0N Offline
    napajejenunedk0
    wrote on last edited by
    #1

    Currently, the only drag and drop place where the icon of a drag action is configurable is when the drag event is "manually created":http://qt-project.org/doc/qt-5/qtwidgets-draganddrop-draggableicons-example.html:
    @
    QDrag *drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->setPixmap(pixmap);
    drag->setHotSpot(event->pos() - child->pos());
    @

    Here:
    @
    drag->setPixmap(pixmap);
    @

    changes the icon of the drag action. But in the case of an externally provoked drag event:
    @
    QWidget::dragEnterEvent(QDragEnterEvent *event)
    @

    it is not possible to change the icon of the drag action.

    I want to drag a file to my application and as the mouse cursor enters the application window's area, I want to change the icon of the drag action. Then if the user doesn't drop the file onto the application window but moves it out of its area, I want to recover the original icon.

    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