QML tableView表格数据添加全选,不选,和禁用状态

import QtQuick 2.14
import QtQuick.Controls 2.14
import Qt.labs.qmlmodels 1.0
import QtGraphicalEffects 1.0

import "../Component"

Item {
    id: mask
    width: parent.width
    height: parent.height

    property bool exportT: false

    function isChanged() {
        let count = table.model.rows.length
        for (var i = 0; i < count; i++) {
            if (table.model.rows[i].checked===1) {
                return true
            }
        }
        return false
    }

    Popup {
        id: popup
        width: 0
        height: 0
        modal: false
        padding: 0
        focus: true
        visible: true
        closePolicy: Popup.NoAutoClose
        Item {

            width: mask.width
            height: mask.height
            DropShadow {
                id: shadow
                anchors.fill: tmpId
                horizontalOffset: 5
                verticalOffset: 5
                radius: 8.0
                samples: 16
                color: "#80000000"
                source: tmpId
            }

            Rectangle {
                id: tmpId
                color: "white"
                z: 9
                width: dpH(1012)
                height: dpH(644)
                radius: dpH(10)

                x: Math.round((mask.width - width) / 2)
                y: Math.round((mask.height - height) / 2)
                visible: true

                Label {
                    id: tmp_top_label
                    text: qsTr("导入任务")
                    color: "#4A6DBC"
                    anchors {
                        top: parent.top
                        topMargin: dpH(21)
                        left: parent.left
                        leftMargin: dpH(47)
                    }
                    font {
                        bold: true
                        family: $font.name
                        pixelSize: dpH(23)
                    }
                }

                Rectangle {
                    z: 10
                    id: tableView
                    width: dpH(919)
                    height: dpH(475)
                    anchors {
                        top: parent.top
                        topMargin: dpH(88)
                        left: parent.left
                        leftMargin: dpH(47)
                    }

                    Item {
                        id: control
                        implicitHeight: parent.height
                        implicitWidth: parent.width

                        //表头行高
                        property int headerHeight: dpH(48)
                        //行高
                        property int rowHeight: dpH(48)
                        property int tableLeft: dpH(100)
                        //滚动条
                        property color scrollBarColor: "#E5E5E5"
                        property int scrollBarWidth: 7
                        //列宽
                        property variant columnWidthArr: [(control.width - control.tableLeft)
                            / 2, (control.width - control.tableLeft) / 2]

                        property var horHeader: ["名称", "格式"]
                        property int selected: -1
                        property var datas: [{
                                "checked": 0,
                                "id": 1,
                                "name": "汽车曲轴分拣项目1",
                                "type": "mission"
                            }, {
                                "checked": 0,
                                "id": 2,
                                "name": "汽车曲轴分拣项目2",
                                "type": "mission"
                            }, {
                                "checked": 0,
                                "id": 3,
                                "name": "汽车曲轴分拣项目3",
                                "type": "mission"
                            }, {
                                "checked": 0,
                                "id": 4,
                                "name": "汽车曲轴分拣项目4",
                                "type": "mission"
                            }, {
                                "checked": 0,
                                "id": 5,
                                "name": "汽车曲轴分拣项目5",
                                "type": "mission"
                            }, {
                                "checked": 0,
                              
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值