Search code examples
qtcheckboxqml

How to set text size of a CheckBox


Is there a way to set the size of a checkbox's text?

I have the following code:

CheckBox {
    text: qsTr("Use Delays")
    checked: false
    anchors.horizontalCenter: parent.horizontalCenter
    onCheckedChanged:
    {
        middle.useDelays = checked
    }
}

Solution

  • You can define the Text item displayed by the CheckBox using CheckBoxStyle.label

    import QtQuick.Controls.Styles 1.4
    
    CheckBox {
        style: CheckBoxStyle {
            label: Text {
                text: "Label"
                font.pointSize: 16
            }
        }
    }