[Qt-interest] Bug in QAbstractItemView drag behaivor?

Qt Mailinglists nylocx at gmail.com
Thu Feb 3 14:24:49 CET 2011


Hi,


A few days ago I came across a strange problem with a QListView I use.

If I drag an item which is not visible if the view is scrolled to the 
top there was no QDrag Pixmap displayed. After some debugging I came up 
with this minimal example:

http://pastebin.com/SVY3U7tE

#include <QtCore/QString>

#include <QtGui/QApplication>
#include <QtGui/QListView>
#include <QtGui/QStringListModel>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	QListView dragList;

	QStringList strings;
	for (int i = 1; i < 100; i++)
		strings << QString("%1. text item").arg(i);

	QStringListModel *dragModel = new QStringListModel(strings, &dragList);

	dragList.setDragEnabled(true);
	dragList.setDragDropMode(QListView::DragOnly);
	dragList.setModel(dragModel);

	dragList.show();

	return a.exec();
}

Can someone confirm that there is a bug if you drag an item which is not 
one of the items which are visible if the view is scrolled to the top.

Sorry for my crappy english, but I hope you where able to understand 
what I tryed to explain.


Alexander



More information about the Qt-interest-old mailing list