标签:turn button ext range fir 练习 qml quick extc
import QtQuick 2.9 // 导入模块
import QtQuick.Window 2.2
import QtQuick.Controls 2.2 // 导入的模块
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
/*
// 不可见元素
Column{
Button {
text: qsTr("btn text")
}
Label {
text: qsTr("red")
color: "red"
font.pointSize: 20
}
RangeSlider {
from: 1
to: 100
first.value: 25
second.value: 75
}
}
Button {
text: qsTr("我是一个按钮")
//槽函数
onClicked: {
console.log("btn click")
text = qsTr("我改变了")
}
onTextChanged: {
console.log("new text",text)
}
}
*/
Button {
text: qsTr("我是按钮")
// 槽函数
onClicked: showAddResult(add(10,20))
// 方法
function add(num1,num2){
return num1+num2
}
function showAddResult(result){
console.log(result)
}
}
}
标签:turn button ext range fir 练习 qml quick extc
原文地址:https://www.cnblogs.com/lodger47/p/14770601.html