Results 1 to 6 of 6

Thread: (Semi-) transparent Drag and Drop

  1. #1
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default (Semi-) transparent Drag and Drop

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: (Semi-) transparent Drag and Drop

    You can use QDrag::setPixmap .
    Also refer to Draggable Icons examples in Drag and Drop section of Qt Demo.
    Qt Code:
    1. QPixmap tempPixmap = pixmap;
    2. QPainter painter;
    3. painter.begin(&tempPixmap);
    4. painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127));
    5. painter.end();
    6.  
    7. child->setPixmap(tempPixmap);
    To copy to clipboard, switch view to plain text mode 

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

    Hope you get the idea

  3. #3
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: (Semi-) transparent Drag and Drop

    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

  4. #4
    Join Date
    May 2008
    Posts
    15
    Thanks
    1

    Default Re: (Semi-) transparent Drag and Drop

    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

  5. #5
    Join Date
    May 2008
    Posts
    15
    Thanks
    1

    Default Re: (Semi-) transparent Drag and Drop

    Plss someone help or give me a clue on how to do it =(

  6. #6
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: (Semi-) transparent Drag and Drop

    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.

Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 20:36
  2. Drag and Drop
    By MrShahi in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2008, 15:01
  3. Problem with a cursor during Drag and Drop
    By mtrpoland in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2007, 15:46
  4. Replies: 7
    Last Post: 8th September 2006, 16:19
  5. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.