[solved] Center Text with letterSpacing
-
I try to center text with non-default letterSpacing:
@
import QtQuick 2.2
import QtQuick.Window 2.1Window {
visible: true
width: 360
height: 360Text { text: qsTr("Hello World") anchors.centerIn: parent font.pointSize: 14 font.letterSpacing: 20 }
}
@but have no luck.
Is there a proper way to do it?
-
It does centering with the above code ? What is the behaviour you observed ? It does put the spacing also at the end of the string as well.
-
[quote author="Dheerendra" date="1404651900"]It does centering with the above code ? What is the behaviour you observed ? It does put the spacing also at the end of the string as well.[/quote]
I understand there is a spacing at the end.
Nevertheless the question stays: is it possible to visually center text with big letterspacing?
-
At least question is not clear to me honestly now
-
[quote author="Dheerendra" date="1404664711"]At least question is not clear to me honestly now[/quote]
Well it is easy: I want text to be like this
@
T E X T ----------------------------------------------------------- @
Not this
@T E X T ----------------------------------------------------------- @
-
You want extra space in the beginning rather than the end. Is that correct ?
-
[quote author="Dheerendra" date="1404696896"]You want extra space in the beginning rather than the end. Is that correct ?[/quote]
I don't want extra space at the end of the text.
Looks like letterSpacing is a part of a letter and thus text with it could not be centered with anchors.
I wonder if an additional space char at the beginnig of text would help. I'll check it when I back to my pc.
-
Adding one space at the beginnig of the text solves it. Visually it looks centered.