Unsolved QPainter drawText line spacing
-
Hello!
I am trying to set a line spacing when I use the drawtext function. I am using this version of the function:
void drawText(const QRectF & rectangle, const QString & text, const QTextOption & option = QTextOption())
But, the lines are very close and a little overlapping. Someone knows how to fix it?
Thank you very much
-
Hi @ivanicy
You can only get the lineSpacing using the QFontMetrics class but not set it (independent of the font size, that is). So you will have to do it yourself using the y-coordinate of the QRect in the drawText function.
-Michael.
-
@ivanicy ,
You can elide the text if it is too long, You can refer this,
http://doc.qt.io/qt-5/qtwidgets-widgets-elidedlabel-example.html