QML is case sensitive. Components must start with a capital letter and also the 
file that defines them. So the file should be A.qml and the use A { }.
The only file that does not have to start with a capital letter is the first 
file you use to kick of the QML app.

- Nigel

Hello,

I am still stuck with the traversal.

Well I have simple example pageloader.qml, a.qml and b.qml and i would like to 
display other qml file when mouse is clicked on the text.I tried Loader {source 
:"a.qml"} and I tried to use "source : "b.qml"" onClicked of a.qml it didn't 
work as source is not in the scope.,couldn't achieve desired result.

//Pageloader.qml
import Qt 4.7

Item {
   width: 200
   height: 200
   a {opacity: 1}    ---->>>>> cannot assign to non-existent property "a"
   b {opacity: 0}
}

//a.qml
import Qt 4.7

Rectangle {
   id: rectangleA
   width: 200
   height: 200
   Text {
       x: 72
       y: 67
       width: 28
       height: 48
       text: "A"
       font.bold: true
       font.pointSize: 30
       anchors.horizontalCenter: parent.horizontalCenter
       anchors.verticalCenter: parent.verticalCenter
       MouseArea{
           anchors.bottomMargin: 0
           anchors.topMargin: 0
           anchors.leftMargin: 0
           anchors.rightMargin: 0
           anchors.fill: parent
           onClicked:{
               console.log("A Clicked!")
           }

       }
   }
}

//b.qml

import Qt 4.7

Rectangle {
   id: rectangleB
   width: 200
   height: 200
   Text {
       x: 72
       y: 67
       width: 28
       height: 48
       text: "B"
       font.bold: true
       font.pointSize: 30
       anchors.horizontalCenter: parent.horizontalCenter
       anchors.verticalCenter: parent.verticalCenter
       MouseArea{
           anchors.bottomMargin: 0
           anchors.topMargin: 0
           anchors.leftMargin: 0
           anchors.rightMargin: 0
           anchors.fill: parent
           onClicked:{
               console.log("B Clicked!")
           }

       }
   }
}

The documentation @ 
http://doc.trolltech.com/4.7-snapshot/qdeclarativescope.html says:

"The component instance scope hierarchy extends to out-of-line components, too. 
In the following example, the TitlePage.qml component creates two TitleText 
instances. Even though the TitleText  element is in a separate file, it still 
has access to the title  property when it is used from within the TitlePage. 
QML is a dynamically scoped language - depending on where it is used, the title 
 property may resolve differently."


Could someone explain how the above statement conflicts with above my test 
example?

Thanks and regards,
Rakesh
-----Original Message-----
From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]]
Sent: Tuesday, April 13, 2010 2:51 AM
To: Mutharaju Rakesh; 
[email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>
Subject: RE: [Qt-qml] Traversing between views


A.qml and B.qml are  part of QML application in my case.But, they
represent two different view all together with different widgets.

Either load both and transition visually:

Item {
   A { opacity: 0 }
   B { opacity: 1 }
   ... logic to change opacities ...
}

Or use Loader to load just one at a time (really only necessary if A and B are 
quite large and complicated).

--
Warwick

_______________________________________________
Qt-qml mailing list
[email protected]<mailto:[email protected]>
http://lists.trolltech.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to