Adding notify signals to SvgItem
These signals are being added in order to keep track of property changes in the QML side. Signed-off-by: Luís Gabriel Lima <lampih@gmail.com>
This commit is contained in:
parent
bcd6a0cc55
commit
999dd60721
@ -42,6 +42,7 @@ SvgItem::~SvgItem()
|
|||||||
void SvgItem::setElementId(const QString &elementID)
|
void SvgItem::setElementId(const QString &elementID)
|
||||||
{
|
{
|
||||||
m_elementID = elementID;
|
m_elementID = elementID;
|
||||||
|
emit elementIdChanged();
|
||||||
emit naturalSizeChanged();
|
emit naturalSizeChanged();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -74,6 +75,7 @@ void SvgItem::setSvg(Plasma::Svg *svg)
|
|||||||
connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
|
connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
|
||||||
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
||||||
}
|
}
|
||||||
|
emit svgChanged();
|
||||||
emit naturalSizeChanged();
|
emit naturalSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +90,7 @@ void SvgItem::setSmooth(const bool smooth)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_smooth = smooth;
|
m_smooth = smooth;
|
||||||
|
emit smoothChanged();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class SvgItem : public QDeclarativeItem
|
|||||||
/**
|
/**
|
||||||
* The sub element of the svg we want to render. If empty the whole svg document will be painted.
|
* The sub element of the svg we want to render. If empty the whole svg document will be painted.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(QString elementId READ elementId WRITE setElementId)
|
Q_PROPERTY(QString elementId READ elementId WRITE setElementId NOTIFY elementIdChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Svg class that is the source of the image, use it like that:
|
* Svg class that is the source of the image, use it like that:
|
||||||
@ -44,7 +44,7 @@ class SvgItem : public QDeclarativeItem
|
|||||||
* </code>
|
* </code>
|
||||||
* Instead of a Svg declaration it can also be the id of a Svg declared elsewhere, useful to share Svg instances.
|
* Instead of a Svg declaration it can also be the id of a Svg declared elsewhere, useful to share Svg instances.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(Plasma::Svg * svg READ svg WRITE setSvg)
|
Q_PROPERTY(Plasma::Svg * svg READ svg WRITE setSvg NOTIFY svgChanged)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The natural, unscaled size of the svg document or the element. useful if a pixel perfect rendering of outlines is needed.
|
* The natural, unscaled size of the svg document or the element. useful if a pixel perfect rendering of outlines is needed.
|
||||||
@ -54,7 +54,7 @@ class SvgItem : public QDeclarativeItem
|
|||||||
/**
|
/**
|
||||||
* If true enable antialiasing in paint: default off, better quality but less performance.
|
* If true enable antialiasing in paint: default off, better quality but less performance.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
|
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SvgItem(QDeclarativeItem *parent=0);
|
SvgItem(QDeclarativeItem *parent=0);
|
||||||
@ -74,7 +74,10 @@ public:
|
|||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
void elementIdChanged();
|
||||||
|
void svgChanged();
|
||||||
void naturalSizeChanged();
|
void naturalSizeChanged();
|
||||||
|
void smoothChanged();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void updateNeeded();
|
void updateNeeded();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user