Advertisement
Guest User

Untitled

a guest
Nov 15th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 2.0
  2.  
  3. Rectangle {
  4.     width: 500
  5.     height: 500
  6.     color: "black"
  7.  
  8.     property string statusText: "Status Text";
  9.     signal button1pressed(var x, var y);
  10.     signal button2pressed(var x, var y);
  11.     signal button3pressed(var x, var y);
  12.     signal button4pressed(var x, var y);
  13.  
  14.     Rectangle {
  15.         id: button1
  16.         width: 100
  17.         height: 50
  18.         anchors.left: parent.left
  19.         anchors.top: parent.top
  20.         color: "lightgreen"
  21.         border.color: "red"
  22.         border.width: 1
  23.  
  24.         Text {
  25.             anchors.centerIn: parent
  26.             text: "Click Me!"
  27.         }
  28.  
  29.         MouseArea {
  30.             anchors.fill: parent
  31.             onClicked: {
  32.                 statusText = "button1 pressed"
  33.                 console.log("Mouse button1 press")
  34.                 button1pressed(150, 25)
  35.             }
  36.         }
  37.     }
  38.     Rectangle {
  39.         id: button2
  40.         width: 100
  41.         height: 50
  42.         anchors.left: parent.left
  43.         anchors.top: button1.bottom
  44.         color: "lightgreen"
  45.         border.color: "red"
  46.         border.width: 1
  47.  
  48.         Text {
  49.             anchors.centerIn: parent
  50.             text: "Click Me!"
  51.         }
  52.  
  53.         MouseArea {
  54.             anchors.fill: parent
  55.             onClicked: {
  56.                 statusText = "button2 pressed"
  57.                 console.log("Mouse button2 press")
  58.                 button2pressed(150, 75)
  59.             }
  60.         }
  61.     }
  62.     Rectangle {
  63.         id: button3
  64.         width: 100
  65.         height: 50
  66.         anchors.left: parent.left
  67.         anchors.top: button2.bottom
  68.         color: "lightgreen"
  69.         border.color: "red"
  70.         border.width: 1
  71.  
  72.         Text {
  73.             anchors.centerIn: parent
  74.             text: "Click Me!"
  75.         }
  76.  
  77.         MouseArea {
  78.             anchors.fill: parent
  79.             onClicked: {
  80.                 statusText = "button3 pressed"
  81.                 console.log("Mouse button3 press")
  82.                 button3pressed(150, 125)
  83.             }
  84.         }
  85.     }
  86.     Rectangle {
  87.         id: button4
  88.         width: 100
  89.         height: 50
  90.         anchors.left: parent.left
  91.         anchors.top: button3.bottom
  92.         color: "lightgreen"
  93.         border.color: "red"
  94.         border.width: 1
  95.  
  96.         Text {
  97.             anchors.centerIn: parent
  98.             text: "Click Me!"
  99.         }
  100.  
  101.         MouseArea {
  102.             anchors.fill: parent
  103.             onClicked: {
  104.                 statusText = "button4 pressed"
  105.                 console.log("Mouse button4 press")
  106.                 button4pressed(150, 175)
  107.             }
  108.         }
  109.     }
  110.  
  111.     Rectangle {
  112.         id: button1sync
  113.         width: 100
  114.         height: 50
  115.         anchors.left: button1.right
  116.         anchors.top: button1.top
  117.         color: "transparent"
  118.         border.color: "red"
  119.         border.width: 1
  120.  
  121.         MouseArea {
  122.             anchors.fill: parent
  123.             onClicked: {
  124.                 console.log("button1sync clicked")
  125.             }
  126.         }
  127.     }
  128.     Rectangle {
  129.         id: button2sync
  130.         width: 100
  131.         height: 50
  132.         anchors.left: button2.right
  133.         anchors.top: button2.top
  134.         color: "transparent"
  135.         border.color: "red"
  136.         border.width: 1
  137.  
  138.         MouseArea {
  139.             anchors.fill: parent
  140.             onClicked: {
  141.                 console.log("button2sync clicked")
  142.             }
  143.         }
  144.     }
  145.     Rectangle {
  146.         id: button3sync
  147.         width: 100
  148.         height: 50
  149.         anchors.left: button3.right
  150.         anchors.top: button3.top
  151.         color: "transparent"
  152.         border.color: "red"
  153.         border.width: 1
  154.  
  155.         MouseArea {
  156.             anchors.fill: parent
  157.             onClicked: {
  158.                 console.log("button3sync clicked")
  159.             }
  160.         }
  161.     }
  162.     Rectangle {
  163.         id: button4sync
  164.         width: 100
  165.         height: 50
  166.         anchors.left: button4.right
  167.         anchors.top: button4.top
  168.         color: "transparent"
  169.         border.color: "red"
  170.         border.width: 1
  171.  
  172.         MouseArea {
  173.             anchors.fill: parent
  174.             onClicked: {
  175.                 console.log("button4sync clicked")
  176.             }
  177.         }
  178.     }
  179.  
  180.     Text {
  181.         id: status
  182.         anchors.centerIn: parent
  183.         color: "white"
  184.         text: statusText
  185.     }
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement