Qt quick Transform ...



  • Hi;
    I would like to manipulate Transform and Scale of an image , using IDs .
    here is my code. my IDs are "imgScaleID" and "transID" :

                Image{
                    id : imageId
                    anchors.centerIn: parent
    
    // My first transform:
                    transform: Scale {
                        id: imgScaleID
                           ...
                    }
    
    // My second transform:
                    transform: Translate {
                        id: transID
                           ...
                    }
                }
    //--------------------------------------------------------------
                MouseArea{
                    onWheel: {
                        imgScaleID.xScale += wheel.angleDelta.y/1200;
                        imgScaleID.yScale += wheel.angleDelta.y/1200;
    
                        transID.x += wheel.angleDelta.y/12;
                        transID.y  += wheel.angleDelta.y/12;
    
                    }
                        ...
                    }
                }
    
    
    

    The problem is , the compiler doesn't accept my second " transform:.. " code...!
    Any idea...?

    Thanks.
    MSD.



  • You can't bind to a property twice I guess. If you look at the docs, you'll see that it holds a list<Transform>.

    Item {
        transform: [
            Scale {
                //...
            },
            Translate {
                //...
            }
        ]
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.