Advertisement
Guest User

Untitled

a guest
Sep 5th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.83 KB | None | 0 0
  1. Rectangle {
  2.     id: root
  3.     property string title
  4.     property int rootIndex: index
  5.     property Component editButtonComponent: Item {}
  6.  
  7.     height: cell.height
  8.  
  9.     property SessionsViewProxy sessionsPresenter: SessionsViewProxy {
  10.  
  11.     }
  12.  
  13.     clip: true
  14.     Behavior on height {
  15.         NumberAnimation { duration: 200 }
  16.     }
  17.     Behavior on width {
  18.         NumberAnimation { duration: 200 }
  19.     }
  20.     border.color: "lightblue"
  21.     border.width: 2
  22.     radius: 4
  23.     Column {
  24.         id: cell
  25.         property bool collapsed: true
  26.         width: parent.width
  27.         padding: 4
  28.  
  29.         Item {
  30.             width: parent.width - parent.padding*2
  31.             height: 30
  32.  
  33.             ItemDelegate {
  34.                 text: root.title
  35.                 onClicked: cell.collapsed = !cell.collapsed
  36.                 anchors.right: iconsRow.left
  37.                 anchors.top: parent.top
  38.                 anchors.bottom: parent.bottom
  39.                 anchors.left: parent.left
  40.                 anchors.margins: 2
  41.             }
  42.  
  43.             Row {
  44.                 id: iconsRow
  45.                 anchors.right: parent.right
  46.                 anchors.top: parent.top
  47.                 anchors.bottom: parent.bottom
  48.                 anchors.margins: 2
  49.                 Loader {
  50.                     anchors.top: parent.top
  51.                     anchors.bottom: parent.bottom
  52.                     sourceComponent: editButtonComponent
  53.                 }
  54.                 Button {
  55.                     width: height
  56.                     anchors.top: parent.top
  57.                     anchors.bottom: parent.bottom
  58.                     text: "⮟"
  59.                     onClicked: cell.collapsed = !cell.collapsed
  60.                     rotation: cell.collapsed ? 90 : 0
  61.                     background: Item {
  62.  
  63.                     }
  64.                     Behavior on rotation {
  65.                         RotationAnimation { duration: 200 }
  66.                     }
  67.                 }
  68.             }
  69.         }
  70.  
  71.         Rectangle {
  72.             anchors.left: parent.left
  73.             anchors.leftMargin: 32
  74.             width: parent.width - parent.padding*2 - 32
  75.             height: sessionsColumn.height
  76.             color: "lightblue"
  77.             radius: 4
  78.             visible: !cell.collapsed
  79.             Column {
  80.                 id: sessionsColumn
  81.                 width: parent.width
  82.                 padding: 1
  83.                 spacing: 1
  84.                 clip: true
  85.                 Repeater {
  86.                     model: sessionsPresenter
  87.                     delegate: SessionCell {
  88.                         id: sessionCell
  89.                         font.pixelSize: 12
  90.                         text: model.created
  91.                         width: parent.width - sessionsColumn.padding * 2
  92.                     }
  93.                 }
  94.             }
  95.  
  96.         }
  97.  
  98.      }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement