qml使用中在listview样式中加入一个button后button的点击效果没有了

小弟最近用qtquick做pc应用,在用listview的时候,在listview的样式中加入了一个button但是没有了button的点击效果,只有样式的的鼠标点击效果,还望大神给解决下;

写大代码贴上来看看,不然不好解决问题的

这种情况 估计是和你加的BUTTON的事件设置有关系 看下你有没有在这个BUTTON设置点击事件可用?

import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Controls 2.1

Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
property var boxarray: [];

MouseArea {
    anchors.fill: parent

}
Rectangle{
    anchors.fill: parent;

    Button{
        anchors.horizontalCenter: parent.horizontalCenter;
        anchors.top: parent.top;
        width: 50;
        height: 40;
        onClicked: {
           frid.model.append({"name": "118"})
        }

    }


    Component{
        id: commmm;
        Rectangle{
            id: rrttc
            width: frid.cellWidth;
            height: frid.cellHeight;

            color: GridView.isCurrentItem ? "red" : "blue"

            Text {

                text: name;
                color: rrttc.GridView.isCurrentItem ? "blue" : "red"
            }

            Button{
                anchors.bottom: parent.bottom;
                anchors.right: parent.right;
                width: 30;
                height: 30;
                onClicked: {
                    console.log("2222")
                }

            }

            MouseArea{
                anchors.fill: parent;
                onClicked: {
                    frid.currentIndex = index;
                    console.log("1111")
                }
            }
        }
    }


    GridView{
        id: frid
        anchors.top: parent.top;
        anchors.topMargin: 40;
        anchors.left: parent.left;
        anchors.right: parent.right;
        anchors.bottom: parent.bottom;
        model: contactModel;
        focus: true;
        highlight: Rectangle{color: "lightsteelblue"; radius: 4}
        delegate: commmm
    }

    ListModel{
        id: contactModel
        ListElement{
            name: "111";
        }

        ListElement{
            name: "112";
        }

        ListElement{
            name: "113";
        }

        ListElement{
            name: "114";
        }

        ListElement{
            name: "115";
        }
    }
}

}

这是一个类似的代码,就是运行起来的话button的点击效果没有也就是只打印“1111”不会打印“2222”