Thank you rajesh for the reply.
For now I can use your suggestion.
Anyway my full problem is how to draw a text in a rotated rectangle with QPainterPath.
The idea is that I don't want to rotate all the QGraphicsItem, but I want to draw a rotated text inside a path with other elements in it. The result will go inside a QGraphicsPathItem.
May be there is a better way to obtain this effect.
Example:
path.lineTo(10, 0); // Horizontal line
path.lineTo(20, 10); // 45° line
path.
addText(QPointF(20,
10), m_font,
"Hello");
QPainterPath path(0, 0);
path.lineTo(10, 0); // Horizontal line
path.lineTo(20, 10); // 45° line
path.addText(QPointF(20,10), m_font, "Hello");
To copy to clipboard, switch view to plain text mode
The last line should specify the rectangle (= text size) in which to draw the text and the angle (in this example 45°), so that the text fits the rectangle and follows the previous line direction.
Bookmarks