[Qt-interest] QDrag::setDragCursor- what does it do?

John Weeks john at wavemetrics.com
Thu Jun 23 18:13:41 CEST 2011


Alex-

Thank you, Alex.

> Have you checked that cursor.pixmap() returns a valid pixmap?
> According to my impression it might not.

Good point. I looked for a QPixmap call to ask if it is valid, but found none. So I did this:

       QCursor cursor(Qt::OpenHandCursor);
	QPixmap cursorpic(cursor.pixmap());
	{
QLabel * qlabel = new QLabel(0);
qlabel->setPixmap(cursorpic);
qlabel->show();
	drag->setDragCursor(cursorpic, Qt::MoveAction);
	}

When I initiate a drag, a very small window with the QLabel appears, and the window has nothing in it, so I guess you're right about that.

However, I then changed it to this:

	QCursor cursor(Qt::OpenHandCursor);
	QPixmap cursorpic(":/Cursors/Cursors/CursorLeftRightUpDown.png");
	{
QLabel * qlabel = new QLabel(0);
qlabel->setPixmap(cursorpic);
qlabel->show();
	drag->setDragCursor(cursorpic, Qt::MoveAction);
	}
 
where the resource file for cursorpic is a four-headed arrow (just a picture I happen to have available). The QLabel now has the expected picture in it, but the drag cursor still uses the arrow cursor.

So far I have no indication that dragCursor actually does anything.

Thanks, John Weeks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110623/1efa8b0f/attachment.html 


More information about the Qt-interest-old mailing list