『QML HelloWorld』学習ノート


テキスト
http://qt-project.org/doc/qt-4.8/qml-tutorial.html
実行効果
《QML HelloWorld》学习笔记_第1张图片
手順1、QMLファイルを作成する(QtCreatorでウィザードに従って作成または直接テキストファイルで名前を付けて保存する)2、ソースコード(..Examples4.7declarativetutorialshelloworld)
import QtQuick 1.0
//![3]
//![1]
Rectangle {
   id: page
   width: 500; height: 200
   color: "lightgray"
//![1]
//![2]
   Text {
       id: helloText
       text: "Hello world!"
       y: 30
       anchors.horizontalCenter: page.horizontalCenter
       font.pointSize: 24; font.bold: true
   }
//![2]
}

3、運転
4、原理
  • Import
  • Rectangle
  • Text

  • 属性yは、親要素の下にある画素数を表し、ここでは30画素である
    属性horizontalCenterは、ページの中心にある水平中央の位置を表します.