Reputation: 11
Let's say a user pastes some random text into a QTextEdit
. How do you determine which font that text is in. For example, Chinese.
I've tried getting the QTextCharFormat
for the block. But it seems to be empty of information.
Querying for fontFamily()
gets me an empty string.
I've also tried to use the QTextLayout
- but that seems to get me the default layout for the document, not for the specific text block.
Thanks for any pointers.
Upvotes: 0
Views: 148
Reputation: 11
It seems you have to go to iterate over the QTextFragment's inside your block. The fragments are what contain the specific font information.
Upvotes: 1