Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.92 KB | None | 0 0
  1. angle {
  2.     id: rectangle
  3.     width: 600
  4.     height: 200
  5.     color: "white"
  6.     border.width: 2
  7.     border.color: "blue"
  8.     anchors.horizontalCenter: parent.horizontalCenter
  9.     anchors.verticalCenter: parent.verticalCenter
  10.  
  11.     ListView {
  12.         id: listView
  13.         focus: true
  14.  
  15.         width: 350
  16.         height: 50
  17.         anchors.verticalCenter: parent.verticalCenter
  18.         anchors.horizontalCenter: parent.horizontalCenter
  19.         clip: true
  20.  
  21.         orientation: ListView.Horizontal
  22.         preferredHighlightBegin: 125
  23.         preferredHighlightEnd: 225
  24.         highlightMoveDuration: 200
  25.         highlightRangeMode: ListView.StrictlyEnforceRange
  26.  
  27.         model: ListModel {
  28.             ListElement {
  29.                 name: "Grey"
  30.                 colorCode: "grey"
  31.             }
  32.  
  33.             ListElement {
  34.                 name: "Red"
  35.                 colorCode: "red"
  36.             }
  37.  
  38.             ListElement {
  39.                 name: "Blue"
  40.                 colorCode: "blue"
  41.             }
  42.  
  43.             ListElement {
  44.                 name: "Green"
  45.                 colorCode: "green"
  46.             }
  47.         }
  48.         delegate: Rectangle {
  49.             width: 100
  50.             height: 50
  51.             color: colorCode
  52.  
  53.             Text {
  54.                 text: name
  55.                 font.bold: true
  56.                 anchors.centerIn: parent
  57.                 color: "white"
  58.             }
  59.         }
  60.     }
  61.  
  62.     Text {
  63.         text: qsTr("center")
  64.         anchors.bottom: listView.top
  65.         anchors.horizontalCenter: parent.horizontalCenter
  66.     }
  67.  
  68.     Text {
  69.         text: qsTr("left")
  70.         anchors.top: listView.bottom
  71.         anchors.right: listView.left
  72.     }
  73.  
  74.     Text {
  75.         text: qsTr("right")
  76.         anchors.top: listView.bottom
  77.         anchors.left: listView.right
  78.     }
  79. }
  80.  
  81. Text {
  82.     anchors.bottom: rectangle.top
  83.     anchors.left: rectangle.left
  84.     text: qsTr("parent")
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement