[Qt-qml] can Anchor-based layout be conditional?
aaron.kennedy at nokia.com
aaron.kennedy at nokia.com
Mon Apr 19 10:01:33 CEST 2010
Hi,
On 19/04/10 5:55 PM, "Rakesh.Mutharaju at tieto.com"
<Rakesh.Mutharaju at tieto.com> wrote:
> states: [
> State {
> name: "landscape"
>
> ParentChange {
> target: rectangle15
> parent: homebar
> }
> PropertyChanges {
> target: rectangle15
> x: 410
> y: 30
> width: 320
> height: parent.height
> }
> AnchorChanges {
> target: rectangle15
> bottom: undefined
> left: image4.left --->>>> cannot assign to non-existent
> property "left"
> top:homebar.top
> }
> }
> ]
>
> could you help me with this? and how can i redefine the Margins w.r.t new
> view?
The docs are out of date. If you check out the example, you'll see it
should be:
AnchorChanges {
target: rectangle15
anchors.bottom: undefined
anchors.left: image4.left
anchors.top:homebar.top
}
The margins can be changed using the PropertyChanges{} element.
Cheers,
Aaron
>
> Br,
> Rakesh.M
>
> From: aaron.kennedy at nokia.com [mailto:aaron.kennedy at nokia.com]
> Sent: Monday, April 19, 2010 10:29 AM
> To: Mutharaju Rakesh; qt-qml at trolltech.com
> Subject: Re: [Qt-qml] can Anchor-based layout be conditional?
>
> Hi,
>
> You can use the AnchorChanges element
> (http://doc.trolltech.com/4.7-snapshot/qml-anchorchanges.html) within a state
> change to modify anchors. Unfortunately we don¹t have any examples showing
> this, but there is an illustrative test under
> tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml
>
> We¹ll make sure we have updated the docs and examples by 4.7.
>
> Cheers,
>
> Aaron
>
>
> On 19/04/10 5:22 PM, "Rakesh.Mutharaju at tieto.com" <Rakesh.Mutharaju at tieto.com>
> wrote:
>
>> Hello,
>>
>> I am quite new to Qt-Quick. Well, i am trying to use the same view
>> for landscape and potrait modes of screen orientation.
>>
>> If i have anchored Rectangle to the view something like
>> Rectangle{
>> anchors.bottom: parent.bottom
>> anchors.bottomMargin: 5
>> }
>>
>> And if I change the screen orientation I would like to have the same
>> rectangle at
>>
>> Rectange{
>> anchors.top:parent.top
>> anchors.topMargin: 5
>> anchors.left:parent.left
>> anchors.leftMargin: 10
>> }
>>
>> I guess this requires some sort of logic to reset the anchors on change of
>> orientation and then have a new set of achors w.r.t to new view.I can write a
>> new state and map it to screen orientation.But, how can I change the
>> anchors?
>>
>> Could someone tell me how to reset the anchors on orientation changes? Or
>> the other alternative seems to have the anchors based on conditions.
>>
>> Thanks and Regards,
>> Rakesh
>>
>>
>
More information about the Qt-qml
mailing list