Add convenience method setSvg() to set the Icon's Svg file instead of the default widget/iconbutton svg. Useful for custom svg button behavour

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=750654
This commit is contained in:
Shawn Starr 2007-12-19 20:32:31 +00:00
parent 5e77ba9e70
commit 60769c4c6f
2 changed files with 12 additions and 0 deletions

View File

@ -452,6 +452,11 @@ void Icon::calculateSize(const QStyleOptionGraphicsItem *option)
update();
}
void Icon::setSvg(const QString &svgFilePath)
{
d->svg.setSvg(svgFilePath);
}
void Icon::Private::drawBackground(QPainter *painter, IconState state)
{
QString element;

View File

@ -52,6 +52,7 @@ class PLASMA_EXPORT Icon : public Plasma::Widget
Q_PROPERTY( QString infoText READ infoText WRITE setInfoText )
Q_PROPERTY( QIcon icon READ icon WRITE setIcon )
Q_PROPERTY( QSizeF iconSize READ iconSize WRITE setIconSize )
Q_PROPERTY( QString svg WRITE setSvg )
public:
/**
* Creates a new Plasma::Icon.
@ -90,6 +91,12 @@ public:
*/
void setText(const QString &text);
/**
* Convenience method to set the svg image to use when given the filepath and name of svg.
* @param svgFilePath the svg filepath including name of the svg.
*/
void setSvg(const QString &svgFilePath);
/**
* Returns the meta text associated with this icon.
*/