diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-09-01 08:39:49 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-09-01 10:53:23 (GMT) |
commit | cc6e8f466111dc04395041cdabb73a831ae802c2 (patch) | |
tree | f9738e4eab9025b4f1f03353b3ecdd70376165af | |
parent | 2a9ffbeda34c04bede04c1aac24eab13fc490fe9 (diff) | |
download | Qt-cc6e8f466111dc04395041cdabb73a831ae802c2.zip Qt-cc6e8f466111dc04395041cdabb73a831ae802c2.tar.gz Qt-cc6e8f466111dc04395041cdabb73a831ae802c2.tar.bz2 |
QGraphicsDropShadowEffect convenience; setXOffset() and setYOffset().
Reviewed-by: Andreas
-rw-r--r-- | src/gui/effects/qgraphicseffect.cpp | 20 | ||||
-rw-r--r-- | src/gui/effects/qgraphicseffect.h | 18 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 1e0ea53..2be6a49 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -840,7 +840,7 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect() By default, the offset is 8 pixels towards the lower right. - \sa blurRadius(), color() + \sa xOffset(), yOffset(), blurRadius(), color() */ QPointF QGraphicsDropShadowEffect::offset() const { @@ -860,6 +860,24 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) } /*! + \property QGraphicsDropShadowEffect::xOffset + \brief the horizontal shadow offset in pixels. + + By default, the horizontal shadow offset is 8 pixels. + + \sa yOffset(), offset() +*/ + +/*! + \property QGraphicsDropShadowEffect::yOffset + \brief the vertical shadow offset in pixels. + + By default, the vertical shadow offset is 8 pixels. + + \sa xOffset(), offset() +*/ + +/*! \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset) This signal is emitted whenever the effect's shadow offset changes. diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index ad941a5..aee7834 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -237,6 +237,8 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged) + Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged) Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) public: @@ -245,15 +247,31 @@ public: QRectF boundingRectFor(const QRectF &rect) const; QPointF offset() const; + + inline qreal xOffset() const + { return offset().x(); } + + inline qreal yOffset() const + { return offset().y(); } + int blurRadius() const; QColor color() const; public Q_SLOTS: void setOffset(const QPointF &ofs); + inline void setOffset(qreal dx, qreal dy) { setOffset(QPointF(dx, dy)); } + inline void setOffset(qreal d) { setOffset(QPointF(d, d)); } + + inline void setXOffset(qreal dx) + { setOffset(QPointF(dx, yOffset())); } + + inline void setYOffset(qreal dy) + { setOffset(QPointF(xOffset(), dy)); } + void setBlurRadius(int blurRadius); void setColor(const QColor &color); |