Unable to assign QQuick3DModel_QML_2 to QQuickItem

33 views Asked by At
Model {
    id : mycube
    position: Qt.vector3d(0, -100, 0)
    source: "#Cube"
    pickable: true
    property bool isPicked: false
    property bool isHovered: false
    materials: [ DefaultMaterial {
            diffuseColor: mycube.isPicked ? "yellow" : mycube.isHovered ? "blue" : "red"
        }
    ]
    MouseArea{
        id : cubemousearea
        anchors.fill: mycube
        hoverEnabled: true
        onEntered: {
            mycube.isHovered = true
        }
        onExited: {
            mycube.isHovered = false
        }
    }

}//Model

I made my 3d cube and mouse area for hover, in View3D, but the line:

anchors.fill :mycube

has an error:

Unable to assign QQuick3DModel_QML_2 to QQuickItem

I changed:

anchors.fill: mycube -> anchors.fill:parent

and it caused no error, but the hover event did not work.

0

There are 0 answers