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. QListWidget drag indicator not showing
Qt 6.11 is out! See what's new in the release blog

QListWidget drag indicator not showing

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 909 Views
  • 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.
  • L Offline
    L Offline
    Leon Zhang
    wrote on last edited by Leon Zhang
    #1

    Hello, I have a simple list widget, and have following drag drop settings:
    setDragEnabled(true);
    setIconSize(QSize(m_PieceSize, m_PieceSize));
    setAcceptDrops(true);
    setDropIndicatorShown(true);
    setDefaultDropAction(Qt::MoveAction);

    But when drag an item and move inside list view, there is no drag indicator showing(no line/rectangle drawn on where dragging item will be dropped), what is the problem?

    Thanks in advance.

    JonBJ 1 Reply Last reply
    0
    • L Leon Zhang

      Hello, I have a simple list widget, and have following drag drop settings:
      setDragEnabled(true);
      setIconSize(QSize(m_PieceSize, m_PieceSize));
      setAcceptDrops(true);
      setDropIndicatorShown(true);
      setDefaultDropAction(Qt::MoveAction);

      But when drag an item and move inside list view, there is no drag indicator showing(no line/rectangle drawn on where dragging item will be dropped), what is the problem?

      Thanks in advance.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Leon-Zhang
      Did you read through Using Drag and Drop with Item Views? Try the examples there, e.g. maybe you need listWidget->setDragDropMode(QAbstractItemView::InternalMove); or the other code shown there.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon Zhang
        wrote on last edited by Leon Zhang
        #3

        @JonB Thanks for reply.
        I have read this Using Drag and Drop with Item Views document carefully, but the method it metioned just not working.
        I have changed code to follow:
        setDragEnabled(true);
        setAcceptDrops(true);
        setDropIndicatorShown(true);
        setDefaultDropAction(Qt::MoveAction);
        this->setDragDropMode(QAbstractItemView::InternalMove);
        this->viewport()->setAcceptDrops(true);

        But it still no change, when I drag item, I can see a black dot drawn on top left corner of list view:
        887067a6-479d-4169-b563-41d6b79f7731-image.png
        But not fully drawn as line and rectangle which encapsulate list items.

        @JonB Is there any simple example project to showcase drag and drop indicator works?

        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