Thanks for the correction. It's now working , I am getting conflict with 
connections.

in pageloader.qml (first file )

import Qt 4.7

Item {

    width: 200

    height: 200

    Loader {

        id:load

        source: "A.qml"

    }

    A{ opacity: 1

        onClicked:{

            console.log("A Clicked!")

            load.source = "B.qml"

            opacity = 0

        }

    }

    B{ opacity: 0

        onClicked:{

            console.log("B Clicked!")

            load.source = "A.qml"

            opacity = 1

        }

    }

}







I renamed the other qml files in CAPS and i introduced the logic on mouse 
clicked "signal clicked()" and onClicked : { rectangleA.clicked() }, i have 
same signal "signal clicked() " in B.qml and onClicked: { rectangleB.clicked() }





signal from A is received in pageloader.qml but signal from B is lost.



thanks

-Rakesh

________________________________
From: [email protected] [mailto:[email protected]]
Sent: Thursday, April 22, 2010 9:59 AM
To: Mutharaju Rakesh
Cc: [email protected]
Subject: Re: [Qt-qml] Traversing between views

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