Guest User

Untitled

a guest
Aug 10th, 2013
1,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 2.1
  2. import QtQuick.Controls 1.0
  3. import QtQuick.Window 2.0
  4.  
  5. ApplicationWindow {
  6.     title: "qml"
  7.     width: 640
  8.     height: 480
  9.  
  10.     Rectangle {
  11.         anchors.fill: parent
  12.         color: Qt.rgba(0, 0, 0, 0.5);
  13.  
  14.         Rectangle {
  15.             color: "#4fa46b"
  16.             height: parent.height/2
  17.             width: parent.width/2
  18.             anchors.centerIn: parent
  19.             border.width: 5
  20.             border.color: "#2e5f3e"
  21.  
  22.             ScrollView {
  23.                 id: scroll
  24.                 anchors.fill: parent
  25.                 anchors.margins: 24
  26.  
  27.                 Column  {
  28.                     spacing: 20
  29.  
  30.                     Text {
  31.                         color: 'white'
  32.                         text: 'Absolute Center.'
  33.                         width: scroll.width
  34.                         wrapMode: Text.WordWrap
  35.                         font {
  36.                             pointSize: 22
  37.                             bold: true
  38.                         }
  39.                     }
  40.  
  41.                     Text {
  42.                         color: 'white'
  43.                         text: 'This box is absolutely centered within the viewport, horizontally and vertically, using only QML.'
  44.                         width: scroll.width
  45.                         wrapMode: Text.WordWrap
  46.                         font.pointSize: 12
  47.                     }
  48.  
  49.                     Text {
  50.                         color: 'white'
  51.                         text: 'Click me to learn more.'
  52.                         width: scroll.width
  53.                         wrapMode: Text.WordWrap
  54.                         font.pointSize: 12
  55.                     }
  56.                 }
  57.             }
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment