Results 1 to 10 of 10

Thread: different model element, different delegate in a list view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: different model element, different delegate in a list view

    Roles are always the same. Their values might not be. If roles are different then you have two separate models. You can declare the delegate in such a way that it takes values into consideration.
    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.


  2. #2
    Join Date
    Feb 2011
    Posts
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: different model element, different delegate in a list view

    Quote Originally Posted by wysota View Post
    Roles are always the same. Their values might not be. If roles are different then you have two separate models. You can declare the delegate in such a way that it takes values into consideration.
    yes, that's the problem. if roles are not the same, what should i do? i think i can't use listmodel anymore.

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

    Default Re: different model element, different delegate in a list view

    I really don't see your point. A model has to be consistent. Keeping "apples" and "cars" in a single model doesn't make any sense if they don't have anything in common. If they do (e.g. they are "objects") then they have the same roles (i.e. "object name", "object type", etc.). Then you can say if "object type" is "car", display it like this, otherwise display it like that.
    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.


  4. #4
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: different model element, different delegate in a list view

    Hi wysota,

    You said
    if "object type" is "car", display it like this, otherwise display it like that.
    .
    How exactly can you embed this "if" condition into the delegate?

    Thanks in advance,
    Wladek
    One second is long, everything longer than two seconds is definitely too long.

  5. #5
    Join Date
    Feb 2011
    Posts
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: different model element, different delegate in a list view

    Quote Originally Posted by wladek View Post
    Hi wysota,

    You said.
    How exactly can you embed this "if" condition into the delegate?

    Thanks in advance,
    Wladek
    you can use ? :

Similar Threads

  1. Model-View-Delegate
    By hotdox in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2010, 13:20
  2. Replies: 8
    Last Post: 6th May 2010, 11:17
  3. How to map tree model data to list view
    By msopanen in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2009, 19:56
  4. Model View - Delegate - setIndexWidget
    By starcontrol in forum Qt Programming
    Replies: 16
    Last Post: 2nd April 2008, 14:30
  5. [QT4.1.1 XP] multi-columns list model/view
    By incapacitant in forum Newbie
    Replies: 1
    Last Post: 26th February 2006, 13: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
  •  
Qt is a trademark of The Qt Company.