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 Dragging Problem after scrolling down the list
Forum Update on Monday, May 27th 2025

QListWidget Dragging Problem after scrolling down the list

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.1k 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
    learningqt
    wrote on last edited by
    #1

    I am creating A Sortable List in Qt. The Code works perfectly well for Downward Scroll but when i having some issues getting the draggable item after i scroll the list down. I have added some test case screenshot for better understanding

    !http://imageshack.us/a/img13/2791/56842367.png(1)!
    !http://imageshack.us/a/img819/8662/87542336.png(3)!
    !http://imageshack.us/a/img24/761/97993758.png(4)!
    !http://imageshack.us/a/img825/1172/93877106.png(5)!

    Well this is the test case code

    @ ui->listWidget->addItem("SongOne");
    ui->listWidget->addItem("SongTwo");
    ui->listWidget->addItem("SongThree");
    ui->listWidget->addItem("SongFour");
    ui->listWidget->addItem("SongFive");
    ui->listWidget->setDragDropMode(QAbstractItemView::InternalMove);
    ui->listWidget->setDragEnabled(true);
    ui->listWidget->setAcceptDrops(true);
    ui->listWidget->setDropIndicatorShown(true);
    ui->listWidget->viewport()->setAcceptDrops(true);
    ui->listWidget->setSelectionMode(QAbstractItemView::SingleSelection);@

    Thankz for taking the time in reading my post. Do help me if you have any hint on what i am missing out.I think i am missing setting some property. In the main Program(not the test code), i tried rewriting the dragMoveEvent and few more method, but no use.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      learningqt
      wrote on last edited by
      #2

      @#include <QtGui>

      int main(int argc, char **argv) {
      QApplication app(argc, argv);
      QListWidget *listWidget = new QListWidget;
      for(int i=0;i<100;++i){
      listWidget->addItem("SongOne");
      listWidget->addItem("SongTwo");
      listWidget->addItem("SongThree");
      listWidget->addItem("SongFour");
      listWidget->addItem("SongFive");
      }
      listWidget->setDragDropMode(QAbstractItemView::InternalMove);
      listWidget->setDragEnabled(true);
      listWidget->setAcceptDrops(true);
      listWidget->setDropIndicatorShown(true);
      listWidget->viewport()->setAcceptDrops(true);
      listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
      listWidget->show();
      app.exec();
      delete listWidget;
      return 0;
      }@

      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