Unsolved QPainter drawText ignores last blank space in a multiple line string
We have a customized QGraphicsItem which paints itself. However, in below code:
QTextOption textOption; textOption.setWrapMode(QTextOption::WrapAnywhere); textOption.setAlignment(Qt::AlignRight); textOption.setFlags(QTextOption::IncludeTrailingSpaces); text = QString("Parameter \nSettings "); painter->drawText(rcText, text, textOption);
The blank space after 'Parameter' is always ignored, but the one after 'Settings' is not ignored.
User wants to get a little border when drawing the text. We know we can reduce the text rectangle to fulfill the request. But still want to know is there anyway to let Qt respect the blank space in first line? Tried many text options and flags but no one works.
@jsulm Tried QTextOption::IncludeTrailingSpaces but not work. QTextOption::IncludeTrailingSpaces has the same defined value as Qt::TextIncludeTrailingSpaces, so I think it does not work as well?