Results 1 to 2 of 2

Thread: Delegate question...

  1. #1
    Join Date
    Aug 2007
    Posts
    265
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Delegate question...

    Guys,

    I have an app that uses QTreeView and MyModel ( a subclass from QAbstractItemModel)

    I have 4 columns in my modelItem and I want to let the 4th column to show true when the value of col 2 and 3 are the same and FALSE otherwise.

    My plan is to populate my model with col 1 to 3 then In my view i would use a delegate on col 4 that will look at cols 2 and 3 and decide if its true or false.

    Is this doable? any other advise from the experts.

    example
    Qt Code:
    1. My tree view
    2.  
    3. Item Data1 Data2 Result
    4. |- a 1 1 TRUE //<-- delegate
    5. | |-a1 1 2 FALSE
    6. |-b 2 2 FALSE
    To copy to clipboard, switch view to plain text mode 

    baray98

  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: Delegate question...

    Is this doable?
    Yes it is

    But it will be better if you keep that logic in the model itself... delegates shouldnt be used for deciding what to display, rather HOW to display

Similar Threads

  1. Painting a CC_ToolButton in a custom delegate
    By victor.fernandez in forum Qt Programming
    Replies: 2
    Last Post: 17th October 2008, 13:11
  2. Delegate for a certain item?
    By somebody in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2008, 23:55
  3. Access from Delegate to Model
    By starcontrol in forum Qt Programming
    Replies: 5
    Last Post: 11th April 2008, 13:26
  4. Replies: 1
    Last Post: 22nd October 2007, 03:04

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.