如何在QML中设置Button控件中文本的字体大小?设计器没有选项,'font'不是Button的有效属性.
Button {
id: cmdQuit
text: qsTr("Quit")
width: 64
height: 32
}
Run Code Online (Sandbox Code Playgroud)
fxa*_*xam 26
您设置Button的样式属性:
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
Rectangle {
id: container
width: 800
height: 800
Button {
id: cmdQuit
text: qsTr("Quit")
width: 64
height: 32
style: ButtonStyle {
label: Text {
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.family: "Helvetica"
font.pointSize: 20
color: "blue"
text: control.text
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15662 次 |
| 最近记录: |