By default you mean the real size of the image? You cannot query the image for 
it original size so what you need to do is the opposite of what you have. Let 
the image load without a width and height. This will then result in the Image 
container auto sizing to the correct size. From here you do know the original 
size and can use it in other states.

import Qt 4.6

Image {
    property string mysource : "test.png"
    id : myimage
    source: mysource

    states: [
    State {
        name : "scaled"
        PropertyChanges{ target: myimage; width: 20; height: 20 }
    },
    State {
        name : "halfSize"
        PropertyChanges{ target: myimage; width: width / 2; height: width / 2 }
    }
    ]

}


Hi,

I have something like this:

Image {
 id : myimage
 source: mysource
 width : 20; height : 20
}

State {
 name : "unscaled"
 PropertyChanges{ target: myimage; width: default height: default }
}

Setting the properties to default does not work.

Is there any way to unset properties in qml?


All the best,

Steve.

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]<mailto:[email protected]>
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to