PDA

View Full Version : QListWidget Dragging Problem after scrolling down the list



learningqt
4th October 2012, 11:04
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
http://imageshack.us/a/img819/8662/87542336.png
http://imageshack.us/a/img24/761/97993758.png
http://imageshack.us/a/img825/1172/93877106.png


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::SingleSelectio n);


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.

wysota
5th October 2012, 01:57
Can you reproduce the problem with the following example?


#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::SingleSelectio n);
listWidget->show();
app.exec();
delete listWidget;
return 0;
}

learningqt
5th October 2012, 16:04
Thankz.Yes its the same and also i will update the question with your code..:)

wysota
7th October 2012, 17:56
I cannot reproduce the bug with the above code. I'm using Qt 4.8 on x64 Linux.

learningqt
8th October 2012, 07:05
HI wysota,

I am using the same conf.(Qt 4.8 on x64 Linux - Ubuntu). i have no clue why this is having.i mean the top ones works perfectly well but when you scroll down to the bottom and try to drag them to the top the bug comes into picture.

I also checked it on my colleague's PC. I am getting the same Bug.

Do i have to do some settings for this?