59 #define QT_SVG_DRAW_SHAPE(command) \ 60 qreal oldOpacity = p->opacity(); \ 61 QBrush oldBrush = p->brush(); \ 62 QPen oldPen = p->pen(); \ 63 p->setPen(Qt::NoPen); \ 64 p->setOpacity(oldOpacity * states.fillOpacity); \ 67 if (oldPen.widthF() != 0) { \ 68 p->setOpacity(oldOpacity * states.strokeOpacity); \ 69 p->setBrush(Qt::NoBrush); \ 71 p->setBrush(oldBrush); \ 73 p->setOpacity(oldOpacity); 78 qWarning(
"<animation> no implemented");
236 m_rect(rect), m_rx(rx), m_ry(ry)
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)
367 appendSpaceNext =
false;
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) {
419 bool endOfBoundsReached =
false;
420 for (
int i = 0; i < tl.
lineCount(); ++i) {
441 endOfBoundsReached =
true;
449 if (endOfBoundsReached)
467 :
QSvgNode(parent), m_link(node), m_start(start)
604 return QRectF(minX, minY, maxX - minX, maxY - minY);
virtual Type type() const
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
The QPainter class performs low-level painting on widgets and other paint devices.
void setAdditionalFormats(const QList< FormatRange > &overrides)
Sets the additional formats supported by the text layout to formatList.
virtual QRectF transformedBounds(QPainter *p, QSvgExtraStates &states) const
QTextOption textOption() const
Returns the current text option used to control the layout process.
The QTextLayout::FormatRange structure is used to apply extra formatting information for a specified ...
virtual void draw(QPainter *p, QSvgExtraStates &states)
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
void setTextOutline(const QPen &pen)
Sets the pen used to draw the outlines of characters to the given pen.
void addText(const QString &text)
void setHeight(int h)
Sets the height of the rectangle to the given height.
void setHeight(qreal h)
Sets the height of the rectangle to the given height.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
const QTransform & transform() const
Returns the world transformation matrix.
qreal opacity() const
Returns the opacity of the painter.
#define QT_END_NAMESPACE
This macro expands to.
QSvgLine(QSvgNode *parent, const QLineF &line)
void setPosition(const QPointF &pos)
Moves the line to position pos.
virtual Type type() const
virtual Type type() const
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
virtual void draw(QPainter *p, QSvgExtraStates &states)
qreal width() const
Returns the width.
QString & replace(int i, int len, QChar after)
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.
QSvgUse(const QPointF &start, QSvgNode *parent, QSvgNode *link)
void setFont(const QFont &font)
Sets the text format's font.
QSvgArc(QSvgNode *parent, const QPainterPath &path)
int width() const
Returns the width of the rectangle.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
virtual Type type() const
virtual Type type() const
The QStack class is a template class that provides a stack.
void setLineWidth(qreal width)
Lays out the line with the given width.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
void drawLine(const QLineF &line)
Draws a line defined by line.
int start
Specifies the beginning of the format range within the text layout's text.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void applyStyle(QPainter *p, QSvgExtraStates &states) const
int height() const
Returns the height of the rectangle.
QSvgNode * parent() const
The QString class provides a Unicode character string.
virtual Type type() const
The QPen class defines how a QPainter should draw lines and outlines of shapes.
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...
QSvgRect(QSvgNode *paren, const QRectF &rect, int rx=0, int ry=0)
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
qreal x() const
Returns the x-coordinate of this point.
QSvgPolyline(QSvgNode *parent, const QPolygonF &poly)
static const uint Default
QSvgPath(QSvgNode *parent, const QPainterPath &qpath)
The QLineF class provides a two-dimensional vector using floating point precision.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
QVector< QSvgTspan * > m_tspans
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal pointSizeF() const
Returns the point size of the font.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
The QRectF class defines a rectangle in the plane using floating point precision. ...
virtual void draw(QPainter *p, QSvgExtraStates &states)
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path...
QSvgText(QSvgNode *parent, const QPointF &coord)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
virtual Type type() const
const QFont & font() const
Returns the currently set font used for drawing text.
virtual void draw(QPainter *p, QSvgExtraStates &states)
QSvgEllipse(QSvgNode *parent, const QRectF &rect)
The QPolygonF class provides a vector of points using floating point precision.
void append(const T &t)
Inserts value at the end of the vector.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
The QPainterPathStroker class is used to generate fillable outlines for a given painter path...
void draw(QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections=QVector< FormatRange >(), const QRectF &clip=QRectF()) const
Draws the whole layout on the painter p at the position specified by pos.
Qt::BrushStyle style() const
Returns the brush style.
static qreal strokeWidth(QPainter *p)
virtual void draw(QPainter *p, QSvgExtraStates &states)
#define QT_SVG_DRAW_SHAPE(command)
void addText(const QString &text)
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
virtual void draw(QPainter *p, QSvgExtraStates &states)
virtual void draw(QPainter *p, QSvgExtraStates &states)
T & front()
This function is provided for STL compatibility.
virtual void draw(QPainter *p, QSvgExtraStates &states)
const QBrush & brush() const
Returns the painter's current brush.
int width() const
Returns the width of the image.
The QTextLayout class is used to lay out and render text.
QString & append(QChar c)
const QTransform & worldTransform() const
Returns the world transformation matrix.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
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...
QSvgPolygon(QSvgNode *parent, const QPolygonF &poly)
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
virtual Type type() const
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
virtual void draw(QPainter *p, QSvgExtraStates &states)
static QRectF boundsOnStroke(QPainter *p, const QPainterPath &path, qreal width)
QSvgImage(QSvgNode *parent, const QImage &image, const QRect &bounds)
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.
void setWidth(int w)
Sets the width of the rectangle to the given width.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
qreal widthF() const
Returns the pen width with floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
static QSvgTspan *const LINEBREAK
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
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.
int height() const
Returns the height of the image.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
qreal y() const
Returns the y-coordinate of this point.
virtual void draw(QPainter *p, QSvgExtraStates &states)
virtual Type type() const
void scale(qreal sx, qreal sy)
Scales the coordinate system by ({sx}, {sy}).
virtual void draw(QPainter *p, QSvgExtraStates &states)=0
int length
Specifies the numer of characters the format range spans.
QTextCharFormat format
Specifies the format to apply.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
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.
virtual Type type() const
virtual void draw(QPainter *p, QSvgExtraStates &states)
virtual void draw(QPainter *p, QSvgExtraStates &states)
void endLayout()
Ends the layout process.
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
void setTextArea(const QSizeF &size)
void setPixelSize(int)
Sets the font size to pixelSize pixels.
virtual Type type() const
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
Draws the given rectangle rect with rounded corners.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
void revertStyle(QPainter *p, QSvgExtraStates &states) const
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
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.
void beginLayout()
Begins the layout process.
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
virtual Type type() const
int lineCount() const
Returns the number of lines in this text layout.
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
virtual Type type() const
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void setWhitespaceMode(QSvgText::WhitespaceMode mode)
#define forever
This macro is provided for convenience for writing infinite loops.