Plasma
Plasma::Svg Class Reference
A theme aware image-centric SVG class. More...
#include <Plasma/Svg>

Signals | |
| void | repaintNeeded () |
Public Member Functions | |
| ~Svg () | |
| bool | containsMultipleImages () const |
| Q_INVOKABLE QString | elementAtPoint (const QPoint &point) const |
| Q_INVOKABLE QRectF | elementRect (const QString &elementId) const |
| Q_INVOKABLE QSize | elementSize (const QString &elementId) const |
| Q_INVOKABLE bool | hasElement (const QString &elementId) const |
| QString | imagePath () const |
| bool | isUsingRenderingCache () const |
| Q_INVOKABLE bool | isValid () const |
| Q_INVOKABLE void | paint (QPainter *painter, int x, int y, int width, int height, const QString &elementID=QString()) |
| Q_INVOKABLE void | paint (QPainter *painter, const QRectF &rect, const QString &elementID=QString()) |
| Q_INVOKABLE void | paint (QPainter *painter, int x, int y, const QString &elementID=QString()) |
| Q_INVOKABLE void | paint (QPainter *painter, const QPointF &point, const QString &elementID=QString()) |
| Q_INVOKABLE QPixmap | pixmap (const QString &elementID=QString()) |
| Q_INVOKABLE void | resize () |
| Q_INVOKABLE void | resize (const QSizeF &size) |
| Q_INVOKABLE void | resize (qreal width, qreal height) |
| void | setContainsMultipleImages (bool multiple) |
| void | setImagePath (const QString &svgFilePath) |
| void | setTheme (Plasma::Theme *theme) |
| void | setUsingRenderingCache (bool useCache) |
| QSize | size () const |
| Theme * | theme () const |
Properties | |
| QString | imagePath |
| bool | multipleImages |
| QSize | size |
| bool | usingRenderingCache |
Related Functions | |
(Note that these are not member functions.) | |
| Svg (QObject *parent=0) | |
Detailed Description
A theme aware image-centric SVG class.
Plasma::Svg provides a class for rendering SVG images to a QPainter in a convenient manner. Unless an absolute path to a file is provided, it loads the SVG document using Plasma::Theme. It also provides a number of internal optimizations to help lower the cost of painting SVGs, such as caching.
- See also:
- Plasma::FrameSvg
Definition at line 56 of file svg.h.
Constructor & Destructor Documentation
Member Function Documentation
| bool Plasma::Svg::containsMultipleImages | ( | ) | const |
| bool Plasma::Svg::hasElement | ( | const QString & | elementId | ) | const |
| QString Plasma::Svg::imagePath | ( | ) | const |
Convenience method to get the svg filepath and name of svg.
- Returns:
- the svg's filepath including name of the svg.
| bool Plasma::Svg::isUsingRenderingCache | ( | ) | const |
| bool Plasma::Svg::isValid | ( | ) | const |
| void Plasma::Svg::paint | ( | QPainter * | painter, | |
| int | x, | |||
| int | y, | |||
| int | width, | |||
| int | height, | |||
| const QString & | elementID = QString() | |||
| ) |
Paints the SVG represented by this object.
- painter the QPainter to use
- x the horizontal coordinate to start painting from
- y the vertical coordinate to start painting from
- width the width of the element to draw
- height the height of the element do draw
- elelementId the ID string of the element to render, or an empty string for the whole SVG (the default)
| void Plasma::Svg::paint | ( | QPainter * | painter, | |
| const QRectF & | rect, | |||
| const QString & | elementID = QString() | |||
| ) |
Paints the SVG represented by this object.
- painter the QPainter to use
- rect the rect to draw into; if smaller than the current size the drawing is starting at this point.
- elelementId the ID string of the element to render, or an empty string for the whole SVG (the default)
Paints the SVG represented by this object.
- painter the QPainter to use
- x the horizontal coordinate to start painting from
- y the vertical coordinate to start painting from
- elelementId the ID string of the element to render, or an empty string for the whole SVG (the default)
| void Plasma::Svg::paint | ( | QPainter * | painter, | |
| const QPointF & | point, | |||
| const QString & | elementID = QString() | |||
| ) |
Paints the SVG represented by this object.
- painter the QPainter to use
- point the position to start drawing; the entire svg will be drawn starting at this point.
- elelementId the ID string of the element to render, or an empty string for the whole SVG (the default)
| void Plasma::Svg::repaintNeeded | ( | ) | [signal] |
| void Plasma::Svg::resize | ( | ) |
| void Plasma::Svg::resize | ( | const QSizeF & | size | ) |
| void Plasma::Svg::resize | ( | qreal | width, | |
| qreal | height | |||
| ) |
| void Plasma::Svg::setContainsMultipleImages | ( | bool | multiple | ) |
| void Plasma::Svg::setImagePath | ( | const QString & | svgFilePath | ) |
Convenience method for setting the svg file to use for the Svg.
- svgFilePath the filepath including name of the svg.
Reimplemented in Plasma::FrameSvg.
| void Plasma::Svg::setTheme | ( | Plasma::Theme * | theme | ) |
Sets the Plasma::Theme to use with this Svg object.
By default, Svg objects use Plasma::Theme::default()
- theme the theme object to use
- Since:
- 4.3
| void Plasma::Svg::setUsingRenderingCache | ( | bool | useCache | ) |
Sets whether or not to cache the results of rendering to pixmaps.
If the Svg is resized and re-rendered often without pattern to the resulting pixmap dimensions, then it may be less efficient to do disk caching. A good example might be a progress meter that uses an Svg object to paint itself: the meter will be changing often enoughi, with enough unpredictability and without re-use of the previous pixmaps to not get a gain from caching.
Most Svg objects should use the caching feature, however. Therefore, the default is to use the render cache.
- Parameters:
-
useCache true to cache rendered pixmaps
- Since:
- 4.3
| QSize Plasma::Svg::size | ( | ) | const |
Currently set size of the SVG.
- Returns:
- the current size of the SVG
| Theme * Plasma::Svg::theme | ( | ) | const |
Friends And Related Function Documentation
| Plasma::Svg::Svg | ( | QObject * | parent = 0 |
) | [related] |
Constructs an SVG object that implicitly shares and caches rendering As opposed to QSvgRenderer, which this class uses internally, Plasma::Svg represents an image generated from an SVG.
As such, it has a related size and transform matrix (the latter being provided by the painter used to paint the image).
The size is initialized to be the SVG's native size.
- parent options QObject to parent this to
Property Documentation
The documentation for this class was generated from the following files:
KDE 4.4 API Reference