Newbie question :flipable ListElement



  • hello pls help me i want to know how can i flip a Listelement in a gridview i tried it on a example:

    @
    Rectangle {
    id: rectangle2
    x: 0
    y: 0
    width: 500
    height: 500
    color: "green"
    z: -1

    Flipable {
        id: flipable
        width: 187
        height: 173
    
        property bool flipped: false
        x: 123
        y: 222
    
    
        /*front: Image { x: 56; y: 56; anchors.verticalCenterOffset: 0; anchors.horizontalCenterOffset: 0; z: 1;
                       source: "/QtCommercial/QtImage/icon_128.png"; anchors.centerIn: parent }*/
    
       * front: ListElement.childAt(0)*        back: Rectangle {x: 20; y: 20; width: 300; height: 300; color: "#200dea"; visible: true;anchors.centerIn: parent }
    
        transform: Rotation {
            id: rotation
            origin.x: flipable.width/2
            origin.y: flipable.height/2
            axis.x: 0; axis.y: 1; axis.z: 0     // set axis.y to 1 to rotate around y-axis
            angle: 0    // the default angle
        }
    
        states: State {
            name: "back"
            PropertyChanges { target: rotation; angle: 180 }
    
            PropertyChanges {
                target: mouse
                visible: false
            }
    
            PropertyChanges {
                target: flipable
                visible: true
            }
    
            PropertyChanges {
                target: rectangle1
                x: 63
                y: 76
                width: 114
                height: 74
                color: "#200dea"
                opacity: 0
            }
    
    
            when: flipable.flipped
        }
    
        transitions: Transition {
            NumberAnimation { target: rotation; property: "angle"; duration: 4000 }
        }
    
        MouseArea {
            id: mouse
            x: 1
            y: 1
            width: 187
            height: 173
            z: 1
            anchors.rightMargin: 0
            anchors.bottomMargin: 0
            anchors.leftMargin: 1
            anchors.topMargin: 1
            anchors.fill: parent
            onClicked: flipable.flipped = !flipable.flipped
    
    
        }
    
        Rectangle {
            id: rectangle1
            x: 20
            y: 20
            width: 200
            height: 200
            color: "#200dea"
            visible: true
            opacity: 0
        }
    
    }
    
    Grid {
        id: grid1
        x: 114
        y: 259
        width: 245
        height: 192
    
        ListView {
            id: list_view1
            x: -159
            y: 649
            width: 110
            height: 160
            anchors.verticalCenter: parent.verticalCenter
            anchors.horizontalCenter: parent.horizontalCenter
            model: ListModel {
    
                *ListElement {name: "Grey";colorCode: "grey"; gridId: 0}*
    
    
            }
            delegate: Item {
                x: 5
                height: 40
                Row {
                    id: row1
                    spacing: 10
                    Rectangle {
                        width: 40
                        height: 40
                        color: colorCode
                    }
    
                    Text {
                        text: name
                        font.bold: true
                        anchors.verticalCenter: parent.verticalCenter
                    }
                }
            }
        }
    }
    

    }
    @


Log in to reply
 

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