hey i also have one problem with loader..........
consider the below code......
@import QtQuick 1.0
Rectangle {
id: container
width: 300
height: 500
color: "black"
Loader {
id: loader
width: 300
height: 500
anchors.rightMargin: 0
anchors.fill: parent
visible: source != ""
}
Column {
x: 25
y: 35
opacity: 1
clip: false
anchors.verticalCenterOffset: 0
anchors.horizontalCenterOffset: 0
spacing: 10
anchors.centerIn: parent
visible: !loader.visible
Button1 { label: "Play"; onClicked: container.state = "play" }
Button1 { label: "Controls"; onClicked: container.state = "control" }
Button1 { label: "About Us"; onClicked: container.state = "aboutus" }
Button1{ label: "Quit"; onClicked: Qt.quit(); }
}
Connections {
target: loader.source != "" ? loader.item : null
onClicked: loader.source = ""
}
states: [
State {
name: "play"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Play.qml"
}
},
State {
name: "control"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Control.qml"
}
},
State {
name: "aboutus"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Aboutus.qml"
}
}@
this code work fine....iand i am able to navigate through pages........but...if i made till changes in the above code...like the one below...the code doesnot work...
@import QtQuick 1.0
Rectangle {
id: container
width: 300
height: 500
color: "black"
item{
id:item1;
source:"/pics/sun.png";
}
Loader {
id: loader
width: 300
height: 500
anchors.rightMargin: 0
anchors.fill: parent
visible: source != ""
}
Column {
x: 25
y: 35
opacity: 1
clip: false
anchors.verticalCenterOffset: 0
anchors.horizontalCenterOffset: 0
spacing: 10
anchors.centerIn: parent
visible: !loader.visible
Button1 { label: "Play"; onClicked: container.state = "play" }
Button1 { label: "Controls"; onClicked: container.state = "control" }
Button1 { label: "About Us"; onClicked: container.state = "aboutus" }
Button1{ label: "Quit"; onClicked: Qt.quit(); }
}
Connections {
target: loader.source != "" ? loader.item : null
onClicked: loader.source = ""
}
states: [
State {
name: "play"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Play.qml"
}
},
State {
name: "control"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Control.qml"
}
},
State {
name: "aboutus"
PropertyChanges {
target: loader
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
source: "Aboutus.qml"
}
}@
here i have just added image on rectangle...and then push buttons...but i am not able to navigate........
so please help me out.......