QML animation + loader



  • Hi to you all!

    Following problem is driving me insane!

    Main.qml
    @import QtQuick 1.1

    Rectangle {
    id: mainScreen;
    width: 1000;
    height: 700;

    property int currentStep: 1;
    property int counter;
    
    ListModel{
        id: quoteModel;
        ListElement { stepWidth: 910; stepN: 1; stepA: true; stepC: "#c0c0c0"; stepNaam: "Hoofdsilo"}
        ListElement { stepWidth: 30; stepN: 2; stepA: false; stepC: "#8c8c8c"; stepNaam: "Weegsysteem"}
        ListElement { stepWidth: 30; stepN: 3; stepA: false; stepC: "#464646"; stepNaam: "Buffer"}
        ListElement { stepWidth: 30; stepN: 4; stepA: false; stepC: "#0c0c0C"; stepNaam: "Voersysteem"}
    }
    
    Item{
        anchors.fill: parent;
    
        Row{
            id: quote;
            anchors.fill: parent;
    
            Repeater{
                model: quoteModel;
    
                Step{
                    id: repStep;
    
                    stepID: stepN;
                    stepActive: stepA;
                    stepColour: stepC;
                    stepName: stepNaam;
    
                    anchors.top: parent.top;
                    anchors.bottom: parent.bottom;
                    width: stepWidth;
    
                    onStepActiveChanged: {
                        if(stepActive){
                            stepSizeOpen.start();
                        }else{
                            stepSizeClose.start();
                        }
                    }
    
                    PropertyAnimation{
                        id: stepSizeOpen;
                        target: repStep;
                        property: "width";
                        to: 910;
                        duration: 500;
                    }
    
                    PropertyAnimation{
                        id: stepSizeClose;
                        target: repStep;
                        property: "width";
                        to: 30;
                        duration: 500;
                    }
    
                    MouseArea {
                        id: mouseArea
                        anchors.fill: parent
    
                        onPressed: {
                            currentStep = stepN;
                            stepActive = true;
    
                            for(counter = 0; counter < 4; counter++){
                                if(counter !== (currentStep - 1)){
                                    quote.children[counter].stepActive = false;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    

    }
    @

    step.qml
    @// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1

    Item {
    id: step;

    property int stepID;
    property bool stepActive;
    
    property string stepColour;
    property string stepName;
    
    
    onStepActiveChanged: {
        console.log(stepID + " " + stepActive + " " + stepName)
    }
    
    Rectangle{
        anchors.fill: parent;
        color: stepColour;
        border.color: "Black";
    
        Text{
            id: stepNaam;
            text: stepName.toString();
            font.family: "Arial";
            font.pointSize: 20;
            font.bold: true;
            color: "#FFFFFF";
    
            y:  stepNaam.paintedWidth + 10;
            transform: Rotation { origin.x: 0; origin.y: 0; angle: -90}
        }
    
        Loader{
            id: contentPane;
            anchors.fill: parent;
            anchors.leftMargin: stepNaam.paintedHeight + 1;
            source: "Weegsysteem.qml";
        }
    }
    

    }
    @

    weegsysteem.qml

    @// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1

    Item {
    width: 100
    height: 62

    Rectangle{
        anchors.fill: parent;
        color: "black";
    }
    

    }
    @

    So as you can see, I have a loader in step.qml. If I have don't try to use the loader in my visualisation (the containers that getting smaller and bigger) are working ok. The moment I add it, it also works but when I try to select the first tab again, it looks like the animation to make that container big again does not work (just copy paste and run)

    This is really driving me insane as I can log it in my console and it claims that the animation is playing. Someone has an idea because i just can't figure it out!

    thanks in advance!

    regards

    Lieven


Log in to reply
 

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