import QtQuick import QtQuick.Layouts // import QtQuick.Controls import QtQuick.Controls 2.16 import "./common" Item{ Column{ anchors.top: parent.top anchors.left: parent.left spacing: 21 Row{ spacing: 7 SetLabel{text: "产品名称:"} SetTextField{ text: g_product onValueChanged: g_product = value } } Row{ spacing: 7 SetLabel{text: "测试人:"} SetTextField{ text: g_user readonly: true } } Row{ spacing: 7 SetLabel{text: "硬件版本:"} SetTextField{ text: "" // onValueChanged: g_settingCompany = value } } Row{ spacing: 7 SetLabel{text: "固件版本:"} SetTextField{ text: "" // onValueChanged: g_settingCompany = value } } Row{ spacing: 7 SetLabel{text: "审核人:"} SetTextField{ text: "" // onValueChanged: g_settingCompany = value } } Row{ spacing: 7 SetLabel{text: "S/N:"} SetTextField{ text: g_sn onValueChanged: g_sn = value } } Row{ spacing: 7 SetLabel{text: "测试日期:"} Row{ spacing: 31 SetSpinBox { id: yearSpinBox from: 1900 to: 9999 value: 2024 onValueChanged: updateDaySpinBox() } SetSpinBox { id: monthSpinBox from: 1 to: 12 value: 1 onValueChanged: updateDaySpinBox() } SetSpinBox { id: daySpinBox from: 1 to: 31 value: 1 } } } } function updateDaySpinBox() { var year = yearSpinBox.value var month = monthSpinBox.value var maxDay = 31 if (month === 4 || month === 6 || month === 9 || month === 11) { maxDay = 30 } else if (month === 2) { if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) { maxDay = 29 } else { maxDay = 28 } } daySpinBox.to = maxDay } }