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:
parent
5e77ba9e70
commit
60769c4c6f
@ -452,6 +452,11 @@ void Icon::calculateSize(const QStyleOptionGraphicsItem *option)
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Icon::setSvg(const QString &svgFilePath)
|
||||||
|
{
|
||||||
|
d->svg.setSvg(svgFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
void Icon::Private::drawBackground(QPainter *painter, IconState state)
|
void Icon::Private::drawBackground(QPainter *painter, IconState state)
|
||||||
{
|
{
|
||||||
QString element;
|
QString element;
|
||||||
|
@ -52,6 +52,7 @@ class PLASMA_EXPORT Icon : public Plasma::Widget
|
|||||||
Q_PROPERTY( QString infoText READ infoText WRITE setInfoText )
|
Q_PROPERTY( QString infoText READ infoText WRITE setInfoText )
|
||||||
Q_PROPERTY( QIcon icon READ icon WRITE setIcon )
|
Q_PROPERTY( QIcon icon READ icon WRITE setIcon )
|
||||||
Q_PROPERTY( QSizeF iconSize READ iconSize WRITE setIconSize )
|
Q_PROPERTY( QSizeF iconSize READ iconSize WRITE setIconSize )
|
||||||
|
Q_PROPERTY( QString svg WRITE setSvg )
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a new Plasma::Icon.
|
* Creates a new Plasma::Icon.
|
||||||
@ -90,6 +91,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setText(const QString &text);
|
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.
|
* Returns the meta text associated with this icon.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user