Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.80 KB | None | 0 0
  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4.     id: r0
  5.     x: 100
  6.     y: 0
  7.     z: 1
  8.     color: "green"
  9.     width: parent.width/2
  10.     height: parent.height/2
  11.     property int myLuckyNumber: 10;
  12.     function foo(num){
  13.         return ("Wyslano: " + num + "")
  14.     }
  15.     signal sig(int num)
  16.     onSig: tx1.text = foo(num)
  17.  
  18.     Text {
  19.         id: tx1
  20.         text: "text"
  21.     }
  22.  
  23.     MouseArea{
  24.         anchors.fill: parent
  25.         drag.target: parent
  26.         drag.axis: Drag.XandYAxis
  27.         drag.minimumX: 0
  28.         drag.minimumY: 0
  29.         drag.maximumX: root.width - parent.width
  30.         drag.maximumY: root.height - parent.height
  31.         onClicked: parent.sig(parent.myLuckyNumber++)
  32.         onPressed: r0.state = "pressed"
  33.         onReleased: r0.state = ""
  34.     }
  35.  
  36.     states: State {
  37.         name: "pressed";
  38.         PropertyChanges {
  39.             target: r0
  40.             color: "black"
  41.  
  42.         }
  43.         PropertyChanges {
  44.             target: r0
  45.             radius: 200
  46.  
  47.         }
  48.     }
  49.  
  50. //    Behavior on color {
  51. //        PropertyAnimation { duration: 250 }
  52. //    }
  53.  
  54.     transitions: [
  55.         Transition {
  56.             from: "pressed"
  57.             PropertyAnimation {
  58.                 target: r0
  59.                 properties: "color"
  60.                 duration: 1000
  61.             }
  62.             PropertyAnimation {
  63.                 target: r0
  64.                 properties: "radius"
  65.                 duration: 1000
  66.             }
  67.         },
  68.  
  69.         Transition {
  70.             to: "pressed"
  71.             PropertyAnimation {
  72.                 target: r0
  73.                 properties: "color"
  74.                 duration: 10
  75.             }
  76.             PropertyAnimation {
  77.                 target: r0
  78.                 properties: "radius"
  79.                 duration: 10
  80.             }
  81.         }
  82.  
  83.     ]
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement