FrameSvgItem: Add notify signals

REVIEW: 105987
This commit is contained in:
Luís Gabriel Lima 2012-08-11 19:13:21 -03:00
parent 91e67c8304
commit db1096edce
2 changed files with 22 additions and 3 deletions

View File

@ -70,8 +70,13 @@ FrameSvgItem::~FrameSvgItem()
void FrameSvgItem::setImagePath(const QString &path)
{
if (m_frameSvg->imagePath() == path)
return;
m_frameSvg->setImagePath(path);
m_frameSvg->setElementPrefix(m_prefix);
emit imagePathChanged();
update();
}
@ -83,8 +88,13 @@ QString FrameSvgItem::imagePath() const
void FrameSvgItem::setPrefix(const QString &prefix)
{
if (m_prefix == prefix)
return;
m_frameSvg->setElementPrefix(prefix);
m_prefix = prefix;
emit prefixChanged();
update();
}
@ -100,7 +110,11 @@ FrameSvgItemMargins *FrameSvgItem::margins() const
void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders)
{
if (m_frameSvg->enabledBorders() == borders)
return;
m_frameSvg->setEnabledBorders(borders);
emit enabledBordersChanged();
}
Plasma::FrameSvg::EnabledBorders FrameSvgItem::enabledBorders() const

View File

@ -73,14 +73,14 @@ class FrameSvgItem : public QDeclarativeItem
/**
* Theme relative path of the svg, like "widgets/background"
*/
Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath)
Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged)
/**
* prefix for the 9 piece svg, like "pushed" or "normal" for the button
* see http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails
* for a list of paths and prefixes
*/
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged)
/**
* The margins of the frame, read only
@ -97,7 +97,7 @@ class FrameSvgItem : public QDeclarativeItem
* LeftBorder
* RightBorder
*/
Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders)
Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders NOTIFY enabledBordersChanged)
public:
FrameSvgItem(QDeclarativeItem *parent=0);
@ -119,6 +119,11 @@ public:
void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
signals:
void imagePathChanged();
void prefixChanged();
void enabledBordersChanged();
private Q_SLOTS:
void doUpdate();