Results 1 to 2 of 2

Thread: QTreeWidget Custom Item Delegate

  1. #1
    Join Date
    Feb 2010
    Posts
    20
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeWidget Custom Item Delegate

    I have a situation where the default editor for the class works fine for most of the items. My problem is that I have a number of items that I want to edit that based off of enumerated types instead of numbers or strings.

    What I would like to do, is for just the enumerated values, Have an itemdelegate editor that displays a dropdown combox with the users options. I can get this to work.

    My problem is that if I assign my editor delegate to the QTreeWidget, then that has to apply for all cells in the tree. My question is, is it possible to selectively apply an item delegate edtor to individual table cells, while leaving the default editor for the rest of the cells?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QTreeWidget Custom Item Delegate

    One way is to set a userrole on each item. For example a role called editortype. Then based on that data, display a different editor.

  3. The following user says thank you to tbscope for this useful post:

    photo_tom (25th May 2010)

Similar Threads

  1. Replies: 5
    Last Post: 10th August 2009, 10:50
  2. Replies: 7
    Last Post: 28th May 2009, 23:49
  3. Replies: 2
    Last Post: 24th May 2009, 10:27
  4. QMovie from inside a custom item delegate
    By Crazy_Hopper in forum Qt Programming
    Replies: 3
    Last Post: 7th May 2008, 15:18
  5. [Qt4] Noob and custom Item Delegate
    By naresh in forum Newbie
    Replies: 36
    Last Post: 19th March 2006, 15:46

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.