Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.82 KB | None | 0 0
  1. import QtQuick 2.12
  2. import QtQuick.Window 2.12
  3.  
  4. Rectangle {
  5.     width: 100
  6.     height: 100
  7.     color: "black"
  8.     MouseArea {
  9.         id: ma
  10.         anchors.fill: parent
  11.         hoverEnabled: true
  12.         cursorShape: Qt.CrossCursor
  13.         onClicked: {
  14.             dot.x = mouseX;
  15.             dot.y = mouseY;
  16.         }
  17.     }
  18.     Rectangle {
  19.         color: "blue"
  20.         width: 1
  21.         height: 1
  22.         x: ma.mouseX
  23.         y: ma.mouseY
  24.     }
  25.     Rectangle {
  26.         id: dot
  27.         color: "red"
  28.         width: 1
  29.         height: 1
  30.         x: -1
  31.         y: -1
  32.         Rectangle {
  33.             width: 20
  34.             height: 1
  35.             x: -10
  36.             z: -1
  37.         }
  38.         Rectangle {
  39.             width: 1
  40.             height: 20
  41.             y: -10
  42.             z: -1
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement