如何在 qml 中将 TextInput 分配给 int?
如何在 qml 中将 TextInput
分配给 int?
int new_span_秒
TextInput {
id: editor
width: 80
height: 17
color: "white"
font.bold: true; font.pixelSize: 14
text: "21"
horizontalAlignment: TextInput.AlignHCenter
}
Keys.forwardTo: [ (returnKey), (editor)]
Item {
id: returnKey
Keys.onReturnPressed: new_span_seconds = editor. <<< ? >>>
Keys.onEnterPressed: new_span_seconds = editor. <<< ? >>>
}
How do I assign an TextInput
to an int, in qml?
int new_span_seconds
TextInput {
id: editor
width: 80
height: 17
color: "white"
font.bold: true; font.pixelSize: 14
text: "21"
horizontalAlignment: TextInput.AlignHCenter
}
Keys.forwardTo: [ (returnKey), (editor)]
Item {
id: returnKey
Keys.onReturnPressed: new_span_seconds = editor. <<< ? >>>
Keys.onEnterPressed: new_span_seconds = editor. <<< ? >>>
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这只是一段 Javascript
It's just a piece of Javascript
利用
js
的 jenky 部分,它允许您通过“乘法”将字符串转换为整数。 F. 前。让 foo = "2";让 bar = foo * 1 。以下是将其应用于您提供的特定代码时的外观:
Take advantage of a jenky part of
js
, which allows you to convert a string into an integer by "multiplying" it. F.ex.let foo = "2"; let bar = foo * 1
.Here's how it looks when applied to the specific code you gave: