import QtQuick 2.5
import QtQuick.Controls 1.4
ApplicationWindow {
visible: true
width: 1366
height: 768
title: qsTr("Loader&Component")
Loader
{
id: m_Loader_1
width: 100
height: 100
x:0
y:0
sourceComponent: m_Compoent
Connections
{
target: m_Loader_1.item
onM_RectClicked:
{
console.log("元件點選信号發出")
}
}
}
id: m_Loader_2
width: 400
height: 400
x:200
Component
id: m_Compoent
Rectangle
width: 300
height: 300
color: "#FF0000"
signal m_RectClicked
MouseArea
anchors.fill: parent
onClicked:
{
m_RectClicked()
}
}
就是這麼多。沒有難度。有什麼不明白,可以問我哦
運作截截圖
