4

Is there a way to get one?

Why I need it. Here I have bad looking UI: Quick Controls 2 bad looking

Here is how I can adjust checkbox size: QML: Resize CheckBox

I want indicator.height value to be equal to font's height.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Alexander Dyagilev
  • 1,139
  • 1
  • 15
  • 43

1 Answers1

5

To calculate the height of the font you must use FontMetrics:

CheckBox {
    text: "CheckBox"
    anchors.centerIn: parent
    checked: true

    indicator.width: indicator.height
    indicator.height: fontMetrics.height

    FontMetrics {
        id: fontMetrics
    }
}

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241