libplasma
Plasma::Svg Class Reference
#include <svg.h>

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.
Definition at line 47 of file svg.h.
Public Types | |
| enum | ContentType { SingleImage = 0, ImageSet } |
Signals | |
| void | repaintNeeded () |
Public Member Functions | |
| ~Svg () | |
| Q_INVOKABLE void | paint (QPainter *painter, const QPointF &point, 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 QRectF &rect, const QString &elementID=QString()) |
| Q_INVOKABLE void | resize (int width, int height) |
| Q_INVOKABLE void | resize (const QSizeF &size) |
| Q_INVOKABLE void | resize () |
| Q_INVOKABLE QSize | elementSize (const QString &elementId) const |
| Q_INVOKABLE QRect | elementRect (const QString &elementId) const |
| Q_INVOKABLE bool | elementExists (const QString &elementId) const |
| Q_INVOKABLE QString | elementAtPoint (const QPoint &point) const |
| Q_INVOKABLE QMatrix | matrixForElement (const QString &elementId) const |
| Q_INVOKABLE bool | isValid () const |
| QSize | size () const |
| void | setContentType (ContentType contentType) |
| ContentType | contentType () |
| void | setFile (const QString &svgFilePath) |
| QString | file () const |
Properties | |
| QSize | size |
| ContentType | contentType |
| QString | file |
Related Functions | |
| (Note that these are not member functions.) | |
| Svg (const QString &imagePath=QString(), QObject *parent=0) | |
Member Enumeration Documentation
Describes what is in the Svg document to be loaded.
The important distinction is whether the Svg is a single image (or group of elements) that are meant to be viewed together, such as a clock face and hands, or a set of images that are meant to be displayed individually, such as a deck of cards.
- Enumerator:
-
SingleImage A set of elements that together make an image. Elements may be drawn separately to accomplish this. This is the default.
ImageSet A set of elements, each of which constitutes a whole image. Each element will therefore be rendered to the set size of the Svg object
Constructor & Destructor Documentation
Member Function Documentation
| void Plasma::Svg::resize | ( | int | width, | |
| int | height | |||
| ) |
| void Plasma::Svg::resize | ( | const QSizeF & | size | ) |
| void Plasma::Svg::resize | ( | ) |
| bool Plasma::Svg::elementExists | ( | const QString & | elementId | ) | const |
| bool Plasma::Svg::isValid | ( | ) | const |
| QSize Plasma::Svg::size | ( | ) | const |
Currently set size of the SVG.
- Returns:
- the current size of a given element
| void Plasma::Svg::setContentType | ( | ContentType | contentType | ) |
Sets what sort of content is in the Svg.
- See also:
- ContentType
- contents whether the Svg is a single image or a set of images
| ContentType Plasma::Svg::contentType | ( | ) |
| void Plasma::Svg::setFile | ( | const QString & | svgFilePath | ) |
| QString Plasma::Svg::file | ( | ) | const |
Convenience method to get the svg filepath and name of svg.
- Returns:
- the svg's filepath including name of the svg.
| void Plasma::Svg::repaintNeeded | ( | ) | [signal] |
Friends And Related Function Documentation
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.
- imagePath the image to show. If a relative path is passed, then Plasma::Theme is used to load the SVG.
- parent options QObject to parent this to
Property Documentation
Svg::ContentType Plasma::Svg::contentType [read, write] |
The documentation for this class was generated from the following files:
KDE 4.0 API Reference