• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

Plasma::Svg

Plasma::Svg Class Reference

#include <svg.h>

Inheritance diagram for Plasma::Svg:

Inheritance graph
[legend]

List of all members.


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 50 of file svg.h.


Signals

void repaintNeeded ()

Public Member Functions

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
Q_INVOKABLE bool isValid () const
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 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)
QSize size () const
 ~Svg ()

Properties

QString filePath
bool multipleImages
QSize size

Related Functions

(Note that these are not member functions.)

 Svg (QObject *parent=0)

Constructor & Destructor Documentation

Plasma::Svg::~Svg (  ) 

Definition at line 314 of file svg.cpp.


Member Function Documentation

bool Plasma::Svg::containsMultipleImages (  )  const

Returns:
whether or not the svg contains multiple images or not

Definition at line 408 of file svg.cpp.

QString Plasma::Svg::elementAtPoint ( const QPoint &  point  )  const

Returns the element (by id) at the given point.

An empty string is returned if no element is at that point.

Definition at line 386 of file svg.cpp.

QRectF Plasma::Svg::elementRect ( const QString &  elementId  )  const

The bounding rect of a given element.

  • elementId the id of the element to check
    Returns:
    the current rect of a given element, given the current size of the Svg

Definition at line 375 of file svg.cpp.

QSize Plasma::Svg::elementSize ( const QString &  elementId  )  const

Size of a given element.

  • elementId the id of the element to check
    Returns:
    the current size of a given element, given the current size of the Svg

Definition at line 370 of file svg.cpp.

bool Plasma::Svg::hasElement ( const QString &  elementId  )  const

Check when an element exists in the loaded Svg.

  • elementId the id of the element to check
    Returns:
    true if the element is defined in the Svg, otherwise false

Definition at line 380 of file svg.cpp.

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.

Definition at line 420 of file svg.cpp.

bool Plasma::Svg::isValid (  )  const

Returns:
true if the SVG file exists and the document is valid, otherwise false.

This method can be expensive as it causes disk access.

Definition at line 397 of file svg.cpp.

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 small than the current size of the drawn starting at this point.

Definition at line 341 of file svg.cpp.

void Plasma::Svg::paint ( QPainter *  painter,
int  x,
int  y,
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

Definition at line 336 of file svg.cpp.

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.

Definition at line 319 of file svg.cpp.

void Plasma::Svg::repaintNeeded (  )  [signal]

void Plasma::Svg::resize (  ) 

Resizes the rendered image to the natural size of the SVG.

Rendering will actually take place on the next call to paint.

Definition at line 364 of file svg.cpp.

void Plasma::Svg::resize ( const QSizeF &  size  ) 

Resizes the rendered image.

Rendering will actually take place on the next call to paint.

  • size the new size of the image

Definition at line 358 of file svg.cpp.

void Plasma::Svg::resize ( qreal  width,
qreal  height 
)

Resizes the rendered image.

Rendering will actually take place on the next call to paint.

  • width the new width
  • height the new height

Definition at line 353 of file svg.cpp.

void Plasma::Svg::setContainsMultipleImages ( bool  multiple  ) 

Set if the svg contains a single image or multiple ones.

  • multiple true if the svg contains multiple images

Definition at line 403 of file svg.cpp.

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::PanelSvg.

Definition at line 413 of file svg.cpp.

QSize Plasma::Svg::size (  )  const

Currently set size of the SVG.

Returns:
the current size of a given element


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

Definition at line 308 of file svg.cpp.


Property Documentation

QString Plasma::Svg::filePath [read, write]

Definition at line 56 of file svg.h.

bool Plasma::Svg::multipleImages [read, write]

Definition at line 55 of file svg.h.

QSize Plasma::Svg::size [read]

Definition at line 54 of file svg.h.


The documentation for this class was generated from the following files:
  • svg.h
  • svg.cpp

libplasma

Skip menu "libplasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal