Consider this simple code sample:
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
visible: true
color: "black"
Text {
text: "Hello World!"
font.family: "Helvetica"
font.pointSize: 24
color: "red"
}
}

Why is there a margin at the top? It seems that giving a custom font with a specific pixelSize gives a new size to the Text and breaks the alignement.
EDIT: well it seems that even without font there still is a margin.
A simpler solution would be to set the attribute y of the Text like this:
Text {
text: "Hello World!"
font.family: "Helvetica"
font.pixelSize: 42
color: "red"
y: -contentHeight + font.pixelSize
}
Bear in mind that if you set the property font.overline: true then it will be out of the Rectangle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With