AC
Қаң. 19, 2024, 10:57 Т.Қ.

QML Обнулить значения SpinBox

QML C++

Доброго времени суток, не могу разобраться с обнулением значение SpinBox находящего в делегате.

import QtQuick
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    function clearValueSpinBox() {
        for (var i = 0; i < usersModel.count; ++i) {
            // обнулить значения Spinbox ??????
        }
    }

    Rectangle {
        id: panel_btn
        height: 40
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.margins: 40

        color: "#eaeef1"
        border.color: "lightsteelblue"
        radius: 5

        Button {
            id: btn_clear
            text: qsTr("Clear value SpinBox")

            onClicked: {
                clearValueSpinBox();
            }
        }
    }

    ListModel {
        id: usersModel

        ListElement {
            name: "Element 1"
        }
        ListElement {
            name: "Element 2"
        }
        ListElement {
            name: "Element 3"
        }
    }

    ListView {
        id: list_view
        anchors.top: panel_btn.bottom
        width: parent.width
        anchors.bottom: parent.bottom
        model: usersModel
        spacing: 5
        delegate: Rectangle {
            id: item_delegat
            height: 40
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.margins: 20

            color: "#eaeef1"
            border.color: "lightsteelblue"
            radius: 5

            Text {
                text: name
                anchors.verticalCenter: parent.verticalCenter
                padding: 10
                font.pixelSize: 12
                font.bold: true
            }

            SpinBox {
                id: spinbox_delegat
                height: 25
                width: 80
                anchors.right: parent.right
                anchors.verticalCenter: parent.verticalCenter
                anchors.rightMargin: 20
            }
        }
    }
}

Буду очень признателен в помощи.

1

Ол саған ұнайды ма? Әлеуметтік желілерде бөлісіңіз!

0

Пікірлер

Тек рұқсаты бар пайдаланушылар ғана пікір қалдыра алады.
Кіріңіз немесе Тіркеліңіз