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. Custom pixmap and dynamic cursor while dragging item from QListView
Qt 6.11 is out! See what's new in the release blog

Custom pixmap and dynamic cursor while dragging item from QListView

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

    How can I achieve these 2 things while dragging an item from QListView:

    1. I'd like to use custom pixmap instead of provided by default (which is just a copy of my item)
    2. Also I'd like to change cursor with one of my own, depending on possibility of underlying area to accept dragged item.
    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      Hi,

      In order to use custom pixmap while dragging you can have a look in "QDrag::setPixmap()":http://doc.qt.nokia.com/4.7-snapshot/qdrag.html#setPixmap. You can write something like

      @QDrag *drag = new QDrag(this);
      drag->setMimeData(/mimeData/);
      drag->setHotSpot(/location/);
      drag->setPixmap(/pixmap/));@

      in startDrag() event or mousePressEvent() whichever you are using.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved