PDA

View Full Version : (Semi-) transparent Drag and Drop



hunsrus
24th June 2008, 12:09
hi everybody,

after a long time searching google i found this forum, in hope to find some help here. i would like to drag some items from one listmodel to another. that works already fine. but to beef up my user interface i would like to make the drag contents visible to the user semitransparent. i hope you can slightly imagine what i want. it is like the drag-function for contacts skype provides. i hope you can help me.
excuse please my english, which is obviously not my native language ;)

greets

hunsrus

aamer4yu
24th June 2008, 15:22
You can use QDrag::setPixmap .
Also refer to Draggable Icons examples in Drag and Drop section of Qt Demo.

QPixmap tempPixmap = pixmap;
QPainter painter;
painter.begin(&tempPixmap);
painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127));
painter.end();

child->setPixmap(tempPixmap);

You can try something like that. Making a pixmap and setting it with the transparent values of the image .

Hope you get the idea :)

hunsrus
24th June 2008, 15:38
hmm

do i have to subclass my QTableView and override the drag and drop methods to get hold of QDrag object?

Ill take a look at the draggable icons demo!

cheers

T1c4L
25th June 2008, 09:47
Hi!

I wanted to apply transparency to my drag n drop too!

How do I implement such transparency when im using the AbstractItemModel Drag and Drop Implementation?

Thanks in advance,
Mike

T1c4L
27th June 2008, 11:27
Plss someone help or give me a clue on how to do it =(

caduel
27th June 2008, 11:30
Yes, you do have to subclass at least the part that creates the pixmap
(QAbstractItemView::startDrag).

If you should find another way (which I doubt), let us know of it.