qmlラーニングqmlラーニング:オブジェクトとプロパティ
1934 ワード
qmlラーニングqmlラーニング:オブジェクトとプロパティ
本文のブログのリンク:http://blog.csdn.net/jdh99、作者:jdh、転載は明記してください.
参考文書<>
環境:
ホスト:WIN 7
開発環境:Qt
ソース:
実行効果:
説明:
コードに1つのオブジェクトがあります:Rectangle
2サブオブジェクト:Image,Text
オブジェクトごとに属性を設定し、ユニークIDを設定できます
idでオブジェクトにアクセスできます.サンプルコード:
実行効果:

本文のブログのリンク:http://blog.csdn.net/jdh99、作者:jdh、転載は明記してください.
参考文書<
環境:
ホスト:WIN 7
開発環境:Qt
ソース:
import QtQuick 1.0
Rectangle
{
width:320
height:240
color:"blue"
Image
{
source:"pics/1.jpg"
anchors.centerIn: parent
}
Text
{
id:txt1
text:"Hello JDH!"
font.pointSize: 24
font.bold: true
anchors.centerIn: parent
}
}
実行効果:

説明:
コードに1つのオブジェクトがあります:Rectangle
2サブオブジェクト:Image,Text
オブジェクトごとに属性を設定し、ユニークIDを設定できます
idでオブジェクトにアクセスできます.サンプルコード:
import QtQuick 1.0
Rectangle
{
width:320
height:240
color:"blue"
Image
{
source:"pics/1.jpg"
anchors.centerIn: parent
}
Text
{
id:txt1
text:"Hello JDH!"
font.pointSize: 24
font.bold: true
anchors.centerIn: parent
}
Text
{
id:txt2
x: -10
y: 199
text:txt1.text + "It is qml!"
font.pointSize: 24
font.bold: true
}
}
実行効果:
