Reputation: 2108
How to use QPainter.drawText() API to display text in vertical direction?
The meaning of vertical direction is:
A
B
C
not like below:
Upvotes: 2
Views: 1187
Reputation: 243907
The solution is to insert endline (\n
) between each character as shown below:
QPainter painter(this);
QString str = "ABCDEFG";
for (int i = 1; i < str.size(); i+=2)
str.insert(i, '\n');
painter.drawText(rect(), Qt::AlignCenter ,str);
Output:
Upvotes: 1