Results 1 to 10 of 10

Thread: <SOLVED > Treeview select draged Item or set mime data from draged item

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2015
    Posts
    25
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default <SOLVED > Treeview select draged Item or set mime data from draged item

    Hi,

    I have a custom Treeview with a QFilemodel attached to it.
    The reason for making it custom is to be able to handel drag and drop myself.
    All I wanted to archiev is to get rid of the Pixmap that is taken from the draged Treeview Item.
    setPixmap does work if I set the mimeData myself.
    The Problem is to get the right Index for the mime Data.

    I tired:
    Qt Code:
    1. QModelIndexList tempindexlist;
    2. tempindexlist.append(selectedIndexes());
    3.  
    4. Drag.setMimeData(model()->mimeData(tempindexlist));
    To copy to clipboard, switch view to plain text mode 

    wich woks if I select the Item to be draged first. So I have to explicitly click on an Item first befor draging it.
    If I just drag it out of the treevie without clicking it previously, the indexlist contains the last selected index (or nothing if there is no selection).

    then I tried it this way:
    Qt Code:
    1. QModelIndexList tempindexlist;
    2. tempindexlist.append(currentIndex());
    To copy to clipboard, switch view to plain text mode 
    but this behaves exactly the same way.

    If I don't set the mimeData it works, but then the Pixmap is set automatically and i can't change it.
    Is there an equivalent of selectedIndexes for draged indexes?
    Any other way to solve this?
    Last edited by 0backbone0; 30th August 2015 at 15:07.

Similar Threads

  1. Finding a item in second column of treeView
    By cszawisza in forum Newbie
    Replies: 5
    Last Post: 20th September 2013, 00:19
  2. Auto Layout TreeView's item?
    By jerry7 in forum Qt Programming
    Replies: 3
    Last Post: 21st September 2010, 06:48
  3. Replies: 1
    Last Post: 28th July 2009, 06:58
  4. current item in treeview
    By kernel_panic in forum Qt Programming
    Replies: 2
    Last Post: 30th October 2007, 19:26
  5. TreeView click item not connecting
    By Big Duck in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2006, 19:38

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.