From db1096edce2019608f0f6def3381c95a6d5070cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Gabriel=20Lima?= Date: Sat, 11 Aug 2012 19:13:21 -0300 Subject: [PATCH] FrameSvgItem: Add notify signals REVIEW: 105987 --- declarativeimports/core/framesvgitem.cpp | 14 ++++++++++++++ declarativeimports/core/framesvgitem.h | 11 ++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/declarativeimports/core/framesvgitem.cpp b/declarativeimports/core/framesvgitem.cpp index 02c9d19e3..a42d6719d 100644 --- a/declarativeimports/core/framesvgitem.cpp +++ b/declarativeimports/core/framesvgitem.cpp @@ -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 diff --git a/declarativeimports/core/framesvgitem.h b/declarativeimports/core/framesvgitem.h index 7baf0cf3c..8182e3446 100644 --- a/declarativeimports/core/framesvgitem.h +++ b/declarativeimports/core/framesvgitem.h @@ -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();