Advertisement
peter9477

Qt on PlayBook hello world QML code

Mar 7th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 1.1
  2. import com.nokia.symbian 1.1
  3.  
  4. Rectangle {
  5.     width: 1024
  6.     height: 600
  7.     color: "pink"
  8.  
  9.     Text {
  10.         id: sometext
  11.         text: "Tap and drag NAO!"
  12.         horizontalAlignment: Text.AlignHCenter
  13.         transformOrigin: Item.Center
  14.         font.pointSize: 36
  15.         font.family: "Verdana"
  16.         smooth: false
  17.         scale: 1
  18.         x: (parent.width - width) / 2
  19.         y: (parent.height - height) / 2
  20.  
  21.         Component.onCompleted: {
  22.             myanim.start()
  23.         }
  24.  
  25.     }
  26.    
  27.     ListView {
  28.         id: grid
  29.         anchors.centerIn: parent
  30.  
  31.         width: parent.width
  32.         height: parent.height
  33.  
  34.         maximumFlickVelocity: 3000
  35.         model: gallery
  36.  
  37.         delegate:
  38.              Component {
  39.                       id: fruitDelegate
  40.                       Row {
  41.                           height: childrenRect.height
  42.                           spacing: 10
  43.                           Button{ text: "Btn Cmpnt"}
  44.                           Text { color: "white" ; text: name }
  45.                           Text { color: "white" ; text: '$' + cost }
  46.                       }
  47.                   }
  48.         }
  49.  
  50.  
  51.     ListModel {
  52.          id: gallery
  53.          ListElement {
  54.              name: "Apple"
  55.              cost: 2.45
  56.          }
  57.          ListElement {
  58.              name: "Orange"
  59.              cost: 3.25
  60.          }
  61.          ListElement {
  62.              name: "Banana"
  63.              cost: 1.95
  64.          }
  65.      }
  66.  
  67.  
  68.     MouseArea {
  69.         x: 0
  70.         y: 0
  71.         width: 1024
  72.         height: 600
  73.         anchors.rightMargin: 20
  74.         anchors.bottomMargin: 20
  75.         anchors.leftMargin: 20
  76.         anchors.topMargin: 20
  77.         anchors.fill: parent
  78.         onPositionChanged: {
  79.             sometext.x = mouse.x - sometext.width / 2
  80.             sometext.y = mouse.y - sometext.height / 2
  81.         }
  82.     }
  83.  
  84.     SequentialAnimation {
  85.         id: myanim
  86.         loops: Animation.Infinite
  87.  
  88.         ParallelAnimation {
  89.             NumberAnimation { target: sometext; property: "rotation";
  90.                 from: 0; to: 360; duration: 1000; easing.type: Easing.OutBack;
  91.             }
  92.             NumberAnimation { target: sometext; property: "opacity";
  93.                 from: 0.2; to: 1; duration: 2000; easing.type: Easing.InQuad;
  94.             }
  95.         }
  96.  
  97.         ParallelAnimation {
  98.             NumberAnimation { target: sometext; property: "rotation";
  99.                 from: 0; to: 360; duration: 2000; easing.type: Easing.OutBack;
  100.             }
  101.             NumberAnimation { target: sometext; property: "opacity";
  102.                 to: 0.2; duration: 2000; easing.type: Easing.InQuart;
  103.             }
  104.         }
  105.     }
  106.    
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement