diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-10-26 10:09:05 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-10-27 08:28:03 (GMT) |
commit | 0ceeded769563914622d26f35397921001c889c8 (patch) | |
tree | a0f7e66097d4563530b81ff51d37f855f5d2d137 /src/gui/effects | |
parent | 487ebd770e1a406270e24aec97a90adea2062c3a (diff) | |
download | Qt-0ceeded769563914622d26f35397921001c889c8.zip Qt-0ceeded769563914622d26f35397921001c889c8.tar.gz Qt-0ceeded769563914622d26f35397921001c889c8.tar.bz2 |
Made blur and drop shadow APIs use qreal instead of int for blur radius.
There's no reason to lock ourselves to int in the API when some of the
backend could handle floating point blur radii.
Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/effects')
-rw-r--r-- | src/gui/effects/qgraphicseffect.cpp | 16 | ||||
-rw-r--r-- | src/gui/effects/qgraphicseffect.h | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 647fd1b..9ed003c 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -630,16 +630,16 @@ QGraphicsBlurEffect::~QGraphicsBlurEffect() By default, the blur radius is 5 pixels. */ -int QGraphicsBlurEffect::blurRadius() const +qreal QGraphicsBlurEffect::blurRadius() const { Q_D(const QGraphicsBlurEffect); return d->filter->radius(); } -void QGraphicsBlurEffect::setBlurRadius(int radius) +void QGraphicsBlurEffect::setBlurRadius(qreal radius) { Q_D(QGraphicsBlurEffect); - if (d->filter->radius() == radius) + if (qFuzzyCompare(d->filter->radius(), radius)) return; d->filter->setRadius(radius); @@ -648,7 +648,7 @@ void QGraphicsBlurEffect::setBlurRadius(int radius) } /*! - \fn void QGraphicsBlurEffect::blurRadiusChanged(int radius) + \fn void QGraphicsBlurEffect::blurRadiusChanged(qreal radius) This signal is emitted whenever the effect's blur radius changes. The \a radius parameter holds the effect's new blur radius. @@ -816,16 +816,16 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset) \sa color(), offset(). */ -int QGraphicsDropShadowEffect::blurRadius() const +qreal QGraphicsDropShadowEffect::blurRadius() const { Q_D(const QGraphicsDropShadowEffect); return d->filter->blurRadius(); } -void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius) +void QGraphicsDropShadowEffect::setBlurRadius(qreal blurRadius) { Q_D(QGraphicsDropShadowEffect); - if (d->filter->blurRadius() == blurRadius) + if (qFuzzyCompare(d->filter->blurRadius(), blurRadius)) return; d->filter->setBlurRadius(blurRadius); @@ -834,7 +834,7 @@ void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius) } /*! - \fn void QGraphicsDropShadowEffect::blurRadiusChanged(int blurRadius) + \fn void QGraphicsDropShadowEffect::blurRadiusChanged(qreal blurRadius) This signal is emitted whenever the effect's blur radius changes. The \a blurRadius parameter holds the effect's new blur radius. diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index abf03b3..bf18581 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -182,22 +182,22 @@ class QGraphicsBlurEffectPrivate; class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT - Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) + Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) public: QGraphicsBlurEffect(QObject *parent = 0); ~QGraphicsBlurEffect(); QRectF boundingRectFor(const QRectF &rect) const; - int blurRadius() const; + qreal blurRadius() const; Qt::RenderHint blurHint() const; public Q_SLOTS: - void setBlurRadius(int blurRadius); + void setBlurRadius(qreal blurRadius); void setBlurHint(Qt::RenderHint hint); Q_SIGNALS: - void blurRadiusChanged(int blurRadius); + void blurRadiusChanged(qreal blurRadius); void blurHintChanged(Qt::RenderHint hint); protected: @@ -215,7 +215,7 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect 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(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) public: QGraphicsDropShadowEffect(QObject *parent = 0); @@ -230,7 +230,7 @@ public: inline qreal yOffset() const { return offset().y(); } - int blurRadius() const; + qreal blurRadius() const; QColor color() const; public Q_SLOTS: @@ -248,12 +248,12 @@ public Q_SLOTS: inline void setYOffset(qreal dy) { setOffset(QPointF(xOffset(), dy)); } - void setBlurRadius(int blurRadius); + void setBlurRadius(qreal blurRadius); void setColor(const QColor &color); Q_SIGNALS: void offsetChanged(const QPointF &offset); - void blurRadiusChanged(int blurRadius); + void blurRadiusChanged(qreal blurRadius); void colorChanged(const QColor &color); protected: |