hi all.
I insert a text and images to QTextEdit , but I found no alignment.
69f68f88gw1f3b1e1io1aj207g01b0sp.jpg
I try setAlignment(Qt::AlignBottom) in QTextEdit , but no change.
hi all.
I insert a text and images to QTextEdit , but I found no alignment.
69f68f88gw1f3b1e1io1aj207g01b0sp.jpg
I try setAlignment(Qt::AlignBottom) in QTextEdit , but no change.
It looks to me like your text is aligned at the bottom. You are forgetting that Western characters have descenders - characters like 'y', 'g', and 'p' extend below the baseline of other characters like 'w', 'e', etc. If you make a text string for testing that contains characters with decenders, I think you will see that these characters do extend to the bottom of the text edit (minus whatever margin the widget is using).
Use QFontMetrics::descent() to obtain the number of pixels used for descenders in your font.
tiaoweiliao (28th April 2016)
Thank you, I got it.
How will the characters like 'y', 'g' at the bottom with image bottom alignment?
ignore characters like 'w', 'e'.
Sorry, I don't understand. Are you saying that you want your text to be bottom aligned with the image of the Chinese characters? You will probably get something better looking if you use Qt:: AlignVCenter on both of them. The it will not matter what the text is, both the text and the image will be vertically centered in the boxes.
Bookmarks