import QtQuick Rectangle { id: root color: "#007EFF" Component.onCompleted: { common.sig_appChanged.connect(appChanged) common.sig_unChecked.connect(unChecked) appChanged() unChecked() } function appChanged() { common.updateAppList() var appList = common.appList() appListModel.clear() for (var i = 0; i < appList.length; ++i) { if(appList[i].show) { var appPath = "./plus/" + appList[i].id var qmlfile = appPath + "/main.qml" var icon = appPath + "/icon.png" appListModel.append({ "id": appList[i].id, "name": appList[i].info.General.Name, "icon": icon, "qmlfile": qmlfile }) } } } function unChecked() { try { lstView.currentIndex = -1 } catch (e) { console.log("unChecked error") } } ListModel { id: appListModel } ListView{ id: lstView anchors.fill: parent model: appListModel spacing: 23 delegate: Item{ width: 110 height: 35 Rectangle{ width: 110 height: 35 clip: true anchors.centerIn: parent color: lstView.currentIndex == index ? "#0969CB" : "#007EFF" Image{ id: icon x: 10 width: 20 height: 20 source: model.icon anchors.verticalCenter: parent.verticalCenter } Text{ width: 75 anchors.left: icon.right anchors.leftMargin: 5 color: "#FFFFFF" text: model.name elide: Text.ElideRight anchors.verticalCenter: parent.verticalCenter font.pixelSize: 14 } MouseArea{ anchors.fill: parent onClicked: { common.changeQml(model.qmlfile) lstView.currentIndex = index } } } } } }