Added a new useful overload.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=872636
This commit is contained in:
parent
7f51dcbf62
commit
69155230cd
6
svg.cpp
6
svg.cpp
@ -376,6 +376,12 @@ void Svg::paint(QPainter *painter, const QRectF &rect, const QString &elementID)
|
||||
painter->drawPixmap(rect, pix, QRectF(QPointF(0, 0), pix.size()));
|
||||
}
|
||||
|
||||
void Svg::paint(QPainter *painter, int x, int y, int width, int height, const QString &elementID)
|
||||
{
|
||||
QPixmap pix(d->findInCache(elementID, QSizeF(width, height)));
|
||||
painter->drawPixmap(x, y, pix, 0, 0, pix.size().width(), pix.size().height());
|
||||
}
|
||||
|
||||
QSize Svg::size() const
|
||||
{
|
||||
return d->size.toSize();
|
||||
|
13
svg.h
13
svg.h
@ -120,6 +120,19 @@ class PLASMA_EXPORT Svg : public QObject
|
||||
Q_INVOKABLE void paint(QPainter *painter, const QRectF &rect,
|
||||
const QString &elementID = QString());
|
||||
|
||||
/**
|
||||
* Paints the SVG represented by this object
|
||||
* @arg painter the QPainter to use
|
||||
* @arg x the horizontal coordinate to start painting from
|
||||
* @arg y the vertical coordinate to start painting from
|
||||
* @arg width the width of the element to draw
|
||||
* @arg height the height of the element do draw
|
||||
* @arg elelementId the ID string of the element to render, or an empty
|
||||
* string for the whole SVG (the default)
|
||||
*/
|
||||
Q_INVOKABLE void paint(QPainter *painter, int x, int y, int width,
|
||||
int height, const QString &elementID = QString());
|
||||
|
||||
/**
|
||||
* Currently set size of the SVG
|
||||
* @return the current size of a given element
|
||||
|
Loading…
Reference in New Issue
Block a user