Advertisement
Guest User

SelectedItemView

a guest
Apr 27th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.73 KB | None | 0 0
  1. Item
  2. {
  3.   ListModel
  4.   {
  5.     id: myModel
  6.  
  7.     ListElement
  8.     {
  9.       name: "Item1"
  10.       type: 1
  11.       status: true
  12.       description: "Long description"
  13.     }
  14.  
  15.     ListElement
  16.     {
  17.       name: "Item2"
  18.       type: 2
  19.       status: false
  20.       description: "Another long description"
  21.     }
  22.   }
  23.  
  24.   ListView
  25.   {
  26.     id: myList
  27.     model: myModel
  28.     delegate: Item
  29.     {
  30.       // Access item's roles
  31.       Text
  32.       {
  33.         text: name
  34.         color: status ? "green" : "gray"
  35.       }
  36.     }
  37.   }
  38.  
  39.   SelectedItemView
  40.   {
  41.     sourceView: myView
  42.     delegate: Item
  43.     {
  44.       // Access item's roles
  45.       // Shows only for selected item
  46.       Text
  47.       {
  48.         text: description
  49.       }
  50.     }
  51.   }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement