43 #ifndef QT_NO_GRAPHICSSVGITEM 50 #include "private/qobject_p.h" 51 #include "private/qgraphicsitem_p.h" 68 q->setParentItem(parent);
73 q->setMaximumCacheSize(
QSize(1024, 768));
90 q_func()->prepareGeometryChange();
159 d->renderer->load(fileName);
160 d->updateDefaultSize();
168 return d_func()->renderer;
178 return d->boundingRect;
203 switch (item->
type()) {
225 const qreal pad = itemPenWidth / 2;
227 const qreal penWidth = 0;
231 fgcolor.
red() > 127 ? 0 : 255,
232 fgcolor.
green() > 127 ? 0 : 255,
233 fgcolor.
blue() > 127 ? 0 : 255);
254 if (!
d->renderer->isValid())
257 if (
d->elemId.isEmpty())
258 d->renderer->render(painter,
d->boundingRect);
260 d->renderer->render(painter,
d->elemId,
d->boundingRect);
340 d->updateDefaultSize();
371 d->updateDefaultSize();
405 #include "moc_qgraphicssvgitem.cpp" 407 #endif // QT_NO_GRAPHICSSVGITEM
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setMaximumCacheSize(const QSize &size)
Sets the maximum device coordinate cache size of the item to size.
QGraphicsSvgItem(QGraphicsItem *parentItem=0)
Constructs a new SVG item with the given parent.
QSvgRenderer * renderer() const
Returns the currently use QSvgRenderer.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
const QTransform & transform() const
Returns the world transformation matrix.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
QPointer< QWidget > widget
QScopedPointer< QGraphicsItemPrivate > d_ptr
QStyle::State state
the style flags that are used when drawing the control
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
virtual QRectF boundingRect() const
Returns the bounding rectangle of this item.
ushort red
Returns the red color component of this color.
The QString class provides a Unicode character string.
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setSharedRenderer(QSvgRenderer *renderer)
Sets renderer to be a shared QSvgRenderer on the item.
The QRectF class defines a rectangle in the plane using floating point precision. ...
void init(QGraphicsItem *parent)
void setCacheMode(CacheMode mode, const QSize &cacheSize=QSize())
Sets the item's cache mode to mode.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void setElementId(const QString &id)
Sets the XML ID of the element to id.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
qreal height() const
Returns the height of the rectangle.
virtual int type() const
Returns the type of an item as an int.
virtual int type() const
Reimplemented Function
QSize defaultSize() const
Returns the default size of the document contents.
qreal width() const
Returns the width of the rectangle.
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
QVariant extra(Extra type) const
QSize toSize() const
Returns the variant as a QSize if the variant has type() Size ; otherwise returns an invalid QSize...
void setSize(const QSizeF &s)
Sets the size of the rectangle to the given size.
QPalette palette
the palette that should be used when painting the control
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
void setCachingEnabled(bool)
Use QGraphicsItem::setCacheMode() instead.
The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsSce...
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
#define Q_DECLARE_PUBLIC(Class)
ushort blue
Returns the blue color component of this color.
The QSvgRenderer class is used to draw the contents of SVG files onto paint devices.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplemented Function
QObject * parent() const
Returns a pointer to the parent object.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
void setExtra(Extra type, const QVariant &value)
QSizeF size() const
Returns the size of the rectangle.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
bool isCachingEnabled() const
Use QGraphicsItem::cacheMode() instead.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
The QSize class defines the size of a two-dimensional object using integer point precision.
The QGraphicsSvgItem class is a QGraphicsItem that can be used to render the contents of SVG files...
QSize maximumCacheSize() const
QString elementId() const
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
static QString fileName(const QString &fileUrl)
static void qt_graphicsItem_highlightSelected(QGraphicsItem *item, QPainter *painter, const QStyleOptionGraphicsItem *option)
Highlights item as selected.
CacheMode cacheMode() const
Returns the cache mode for this item.
QRectF boundsOnElement(const QString &id) const
Returns bounding rectangle of the item with the given id.
The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene.