Results 1 to 3 of 3

Thread: When itemDelegate have specific value, change properties

  1. #1
    Join Date
    Apr 2014
    Location
    Płock, Poland
    Posts
    13
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default When itemDelegate have specific value, change properties

    Hello
    How to change properties for delegate, when item have a specific property ? I don't know which signal is good for this to use function.
    Qt Code:
    1. Component {
    2. id: listSendedDelegate
    3. Rectangle {
    4. color: "#50B7C8"
    5. radius: 5
    6. width: parent.width; height: 100
    7. Column {
    8. Text { text: datasms + " " + stan }
    9. Text { font.bold: true;font.pixelSize: 12;text: trescsms; }
    10.  
    11. }
    12. //this problem (if this item has a stan=="undefined" change background color for this item to green
    13. Component.onCompleted: {
    14. if(stan=="undefined")
    15. color="green"
    16. }
    17. //this problem
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: When itemDelegate have specific value, change properties

    You don't need any signal for that, changing one property based on the value of another is normal usage for property bindings

    Qt Code:
    1. color: stan == "undefined" ? "green" : "#50B7C8"
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

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

    updaterr (10th June 2014)

  4. #3
    Join Date
    Apr 2014
    Location
    Płock, Poland
    Posts
    13
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: When itemDelegate have specific value, change properties

    ahh... so simple... i forget about that...

Similar Threads

  1. Change properties of delegates in ListView
    By SteelBlade in forum Qt Quick
    Replies: 2
    Last Post: 14th June 2013, 11:23
  2. Replies: 5
    Last Post: 14th February 2011, 14:06
  3. Replies: 1
    Last Post: 20th January 2011, 17:17
  4. QTreeView and itemDelegate code
    By alexandernst in forum Newbie
    Replies: 1
    Last Post: 22nd April 2010, 17:00
  5. How is it easier to change font properties?
    By alex chpenst in forum Qt Programming
    Replies: 1
    Last Post: 11th July 2008, 20:01

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
  •  
Qt is a trademark of The Qt Company.