1.list item
import QtQuick 2.5
import QtQuick.Controls 2.15
import QtQuick.Controls.Styles 1.4
import QtQml.Models 2.2
import QtQuick.Dialogs 1.0
import QtGraphicalEffects 1.0
import QtQml 2.0
Rectangle {
property int type: 0 //成功检查或失败检查
id: tabViewSysCheck_id
anchors.fill: parent
ListModel{
id:sysCheckList_model
}
ListView{
id:lstView_id
anchors.fill: parent
// boundsBehavior:Flickable.StopAtBounds
model: sysCheckList_model
// y : -vbar.position*height
delegate: Item{
width: lstView_id.width
height: 20
//app的图标
Image {
id: sysLogo_id
source: (type===0) ? "qrc:/images/sysCheckErr.png":"qrc:/images/sysCheckSuccess.png";
anchors{
left: parent.left
leftMargin: 10
}
height: 20
width: 20
fillMode: Image.PreserveAspectCrop
}
//app的http地址
Text {
id: sysText_id
font.family: "Microsoft Yahei"
font.pixelSize: 16
text: m_appName
anchors{
left: sysLogo_id.right
top:sysLogo_id.top
bottom: sysLogo_id.bottom
right: parent.right-20
leftMargin: 10
rightMargin: 10
}
color: (type===0)?"#7c7c7c":"green"
wrapMode: elide
}
Button{
id: fix_btn
height

本文档提供了一个关于如何在QT QML中使用ListView控件的示例,包括设置list item,添加listview标题,以及处理成功或失败的检测信息和数据属性。
最低0.47元/天 解锁文章
1285

被折叠的 条评论
为什么被折叠?



