I finally figured it out. It only started working after I got my data from a QAbstractTableModel. I guess otherwise the rows were not redrawn.

In any case, here is what I ended up with:
Qt Code:
  1. import QtQuick 2.4
  2. import QtQuick.Window 2.2
  3. import QtQuick.Controls 1.2
  4. import QtQuick.Controls.Styles 1.2
  5. import MoeFileModel 1.0
  6.  
  7. Window {
  8. visible: true
  9. width: 800
  10. height:600
  11.  
  12.  
  13. FileModelHandler {
  14. id: fileModelHandler
  15. }
  16.  
  17. TableView {
  18. id: tv
  19. anchors.fill: parent
  20. model: fileModelHandler
  21.  
  22. rowDelegate: Rectangle {
  23. property int sizeOpen: 60
  24. property int sizeClosed: 20
  25.  
  26. id: rowDelegate
  27. color: styleData.alternate ? "#666666" : "#555555"
  28. height: getSize() // styleData.selected? sizeOpen : sizeClosed
  29.  
  30. function getSize()
  31. {
  32. if(!tv.selection.contains(styleData.row))
  33. {
  34. doClose.start();
  35. return sizeClosed;
  36. }
  37.  
  38. return sizeOpen;
  39. }
  40.  
  41. MouseArea {
  42. anchors.top: parent.top
  43. anchors.left: parent.left
  44. anchors.right: parent.right
  45. height: sizeClosed
  46. propagateComposedEvents: true
  47. preventStealing: true
  48. acceptedButtons: Qt.LeftButton | Qt.RightButton
  49.  
  50. onClicked: {
  51. if(rowDelegate.sizeOpen == rowDelegate.height)
  52. {
  53. tv.selection.deselect(styleData.row);
  54. doClose.start()
  55. }
  56. else
  57. {
  58. tv.selection.clear();
  59. tv.selection.select(styleData.row);
  60. doOpen.start();
  61. }
  62. }
  63. }
  64.  
  65. ParallelAnimation {
  66. id: doOpen
  67. running: false
  68. NumberAnimation { target: rowDelegate; easing.type: Easing.OutSine; property: "height"; to: sizeOpen; duration: 100 }
  69. }
  70. ParallelAnimation {
  71. id: doClose
  72. running: false
  73. NumberAnimation { target: rowDelegate; easing.type: Easing.OutSine; property: "height"; to: sizeClosed; duration: 100; }
  74. }
  75. }
  76.  
  77. // columns go here...
  78. TableViewColumn {}
  79. }
  80. }
To copy to clipboard, switch view to plain text mode