Results 1 to 2 of 2

Thread: How to select the dropped item in a QTreeWidget?

  1. #1
    Join Date
    Sep 2009
    Posts
    19
    Qt products
    Platforms
    Unix/X11

    Default How to select the dropped item in a QTreeWidget?

    self.setCurrentItem(self.itemAt(event.pos())) selects "randomly" the dropped item or the ones around it

  2. #2
    Join Date
    Sep 2009
    Posts
    19
    Qt products
    Platforms
    Unix/X11

    Default Re: How to select the dropped item in a QTreeWidget?

    for those interested, I achieved it by reimplementing the QTreeWidget.dropMimeData() method:
    Qt Code:
    1. def dropMimeData(self, parent, index, data, action):
    2. self.dropped = (parent,index)
    3. idx = QModelIndex()
    4. if parent: idx = self.indexFromItem(parent)
    5. return QAbstractItemModel.dropMimeData(self.model(), data, action , index, 0, idx)
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. popupmenu for QTreeWidget's item when a particular item selected.
    By vinod sharma in forum Best Practices in Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 11:45
  2. Replies: 1
    Last Post: 20th January 2010, 09:38
  3. can't select item in a QTreeWidget via code
    By zack in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2009, 21:31
  4. QTreeWidget select item
    By ^NyAw^ in forum Qt Programming
    Replies: 7
    Last Post: 26th October 2007, 15:26
  5. Cannot select an item in QComboBox
    By Declan in forum Qt Programming
    Replies: 2
    Last Post: 19th April 2007, 09:08

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.