Results 1 to 3 of 3

Thread: Retrieve QTreeWidgetItem in delegate

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    15
    Thanks
    4
    Qt products
    Qt4

    Default Retrieve QTreeWidgetItem in delegate

    I have a class that inherits QStyledItemDelegate. I override the following methods:

    Qt Code:
    1. QWidget *createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
    2. void setModelData( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const;
    3. void setEditorData ( QWidget * editor, const QModelIndex & index ) const;
    To copy to clipboard, switch view to plain text mode 

    Is it possible to retrieve the QTreeWidgetItem on which the user clicked in the createEditor method of the delegate?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Retrieve QTreeWidgetItem in delegate

    If you pass a pointer to the tree widget to the delegate so that you can retrieve it in createEditor() then you can use QTreeWidget::itemFromIndex().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following 2 users say thank you to wysota for this useful post:

    Phlucious (3rd June 2016), torres (4th April 2011)

Similar Threads

  1. Retrieve other windows geometry
    By Talei in forum Newbie
    Replies: 1
    Last Post: 25th January 2011, 23:27
  2. Replies: 5
    Last Post: 23rd September 2010, 13:58
  3. retrieve code from DLL
    By kernel.roy in forum Qt Programming
    Replies: 1
    Last Post: 15th September 2010, 08:03
  4. retrieve code from DLL
    By kernel.roy in forum Newbie
    Replies: 1
    Last Post: 15th September 2010, 06:21
  5. Replies: 2
    Last Post: 24th May 2009, 10:27

Tags for this Thread

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.