Advertisement
vavan_bonus

tmp listview2

Feb 3rd, 2021
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1.  
  2. import QtQuick 2.5
  3. import QtQuick.Controls 2.5
  4. import QtQuick.Layouts 1.0
  5.  
  6.  
  7. Rectangle
  8. {
  9. id: root;
  10. height: 500;
  11. width: 200;
  12.  
  13. ListView {
  14. id: myListView
  15. //Layout.preferredHeight: 100
  16. //Layout.fillWidth: true
  17. width: parent.width
  18. height: 100
  19. implicitWidth: contentWidth
  20. spacing: 10
  21.  
  22. orientation: ListView.Horizontal
  23.  
  24.  
  25. snapMode: ListView.SnapToItem//SnapOneItem
  26.  
  27. //layoutDirection: Qt.LeftToRight
  28.  
  29. model: 4
  30.  
  31. delegate: Rectangle {
  32. height: 50; width: 50
  33. color: "transparent"
  34. border.color: "blue"
  35. }
  36. //headerPositioning: ListView.InlineHeader //
  37. headerPositioning: ListView.OverlayHeader
  38.  
  39.  
  40. // header: Item {
  41. // Rectangle {
  42. // anchors.leftMargin: 10
  43. // anchors.left: parent.left
  44. // height: 100; width: 100
  45.  
  46. // Rectangle {
  47. // anchors.fill: parent
  48. // color: 'blue'
  49. // //source: "image://icons/add"
  50. // }
  51.  
  52. // color: "transparent"
  53. // border.color: "blue"
  54. // }
  55.  
  56. // }
  57. header: Rectangle {
  58. id: headerItem
  59. property bool test: (myListView.visibleArea.xPosition*myListView.width > 50/2) ? true:false
  60. width: 120// myList.width
  61. height: 30
  62. //z: 2
  63.  
  64. color: "blue"
  65.  
  66. Text {
  67. text: test //+ myListView.visibleArea.xPosition*myListView.width
  68. color: "red"
  69. }
  70. }
  71. }
  72. }
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement