302 p->
scale(1 / scale, 1 / scale);
312 px += scaledSize.
width() / 2;
314 px += scaledSize.
width();
321 bool appendSpace =
false;
339 formatRanges.
back().append(range);
359 if (appendSpace || prependSpace)
366 if (newText.isEmpty())
367 appendSpaceNext =
false;
372 range.
length = newText.length();
379 ++formatRanges.
back().back().length;
380 }
else if (prependSpace) {
384 formatRanges.
back().append(range);
386 appendSpace = appendSpaceNext;
387 paragraphs.
back() += newText;
389 m_tspans[i]->revertStyle(p, states);
396 for (
int i = 1; i < paragraphs.
size(); ++i) {
398 text.
append(paragraphs[i]);
402 for (
int i = 0; i < paragraphs.
size(); ++i) {
406 tl.setTextOption(op);
407 tl.setAdditionalFormats(formatRanges[i]);
419 bool endOfBoundsReached =
false;
420 for (
int i = 0; i < tl.lineCount(); ++i) {
441 endOfBoundsReached =
true;
449 if (endOfBoundsReached)
The QTextLayout::FormatRange structure is used to apply extra formatting information for a specified ...
void setTextOutline(const QPen &pen)
Sets the pen used to draw the outlines of characters to the given pen.
void setHeight(qreal h)
Sets the height of the rectangle to the given height.
qreal opacity() const
Returns the opacity of the painter.
void setPosition(const QPointF &pos)
Moves the line to position pos.
qreal width() const
Returns the width.
int length() const
Returns the number of characters in this string.
The QPointF class defines a point in the plane using floating point precision.
qreal height() const
Returns the height.
The QTextLine class represents a line of text inside a QTextLayout.
void setFont(const QFont &font)
Sets the text format's font.
The QStack class is a template class that provides a stack.
void setLineWidth(qreal width)
Lays out the line with the given width.
int start
Specifies the beginning of the format range within the text layout's text.
void applyStyle(QPainter *p, QSvgExtraStates &states) const
The QString class provides a Unicode character string.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
qreal ascent() const
Returns the line's ascent.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
qreal x() const
Returns the x-coordinate of this point.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
QVector< QSvgTspan * > m_tspans
const QPen & pen() const
Returns the painter's current pen.
qreal pointSizeF() const
Returns the point size of the font.
The QRectF class defines a rectangle in the plane using floating point precision. ...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const QFont & font() const
Returns the currently set font used for drawing text.
bool endsWith(const T &t) const
Returns true if this vector is not empty and its last item is equal to value; otherwise returns false...
T & front()
This function is provided for STL compatibility.
const QBrush & brush() const
Returns the painter's current brush.
The QTextLayout class is used to lay out and render text.
QString & append(QChar c)
const QTransform & worldTransform() const
Returns the world transformation matrix.
The QFont class specifies a font used for drawing text.
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
void draw(QPainter *p, const QPointF &point, const QString &str, qreal pixelSize, Qt::Alignment alignment) const
reference back()
This function is provided for STL compatibility.
static QSvgTspan *const LINEBREAK
void push_back(const T &t)
This function is provided for STL compatibility.
The QTextOption class provides a description of general rich text properties.
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
qreal y() const
Returns the y-coordinate of this point.
void scale(qreal sx, qreal sy)
Scales the coordinate system by ({sx}, {sy}).
int length
Specifies the numer of characters the format range spans.
QTextCharFormat format
Specifies the format to apply.
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
void setPixelSize(int)
Sets the font size to pixelSize pixels.
void revertStyle(QPainter *p, QSvgExtraStates &states) const
int size() const
Returns the number of items in the vector.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
qreal height() const
Returns the line's height.
#define forever
This macro is provided for convenience for writing infinite loops.