Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.22 KB | None | 0 0
  1.     Grid {
  2.         id: numpad
  3.         rows: 3
  4.         columns: 3
  5.         spacing: 10
  6.  
  7.         Repeater {
  8.             model: 9
  9.  
  10.             MouseArea {
  11.                 width: 90
  12.                 height: width
  13.                 preventStealing: true
  14.  
  15.                 Rectangle {
  16.                     color: black
  17.                     anchors.fill: parent
  18.                 }
  19.  
  20.                 onClicked: {
  21.                     entry(index + 1);
  22.                 }
  23.  
  24.                 drag.target: this
  25.  
  26.                 drag.onActiveChanged: {
  27.                     if (drag.active) {
  28.                         drag.target = dragComponent.createObject(this)
  29.                     }
  30.                 }
  31.  
  32.                 Component {
  33.                     id: dragComponent
  34.                     Text {
  35.                         property bool dragActive: parent.drag.active
  36.                         id:dragIndicator
  37.                         text: index + 1
  38.                         font.bold: true
  39.                         x: parent.mouseX - width/2
  40.                         y: parent.mouseY - height/2
  41.  
  42.                         onDragActiveChanged: if (!dragActive) this.destroy()
  43.                     }
  44.                 }
  45.             }
  46.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement