summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qnamespace.h5
-rw-r--r--src/corelib/global/qnamespace.qdoc15
-rw-r--r--src/gui/effects/qgraphicseffect.cpp36
-rw-r--r--src/gui/effects/qgraphicseffect.h13
-rw-r--r--src/gui/image/qpixmapfilter.cpp8
-rw-r--r--src/gui/image/qpixmapfilter_p.h9
-rw-r--r--src/opengl/qglpixmapfilter.cpp18
7 files changed, 50 insertions, 54 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 741c06f..473398b 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1627,6 +1627,11 @@ public:
NavigationModeCursorAuto,
NavigationModeCursorForceVisible
};
+
+ enum RenderHint {
+ QualityHint,
+ PerformanceHint
+ };
}
#ifdef Q_MOC_RUN
;
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 40dd1d2..1833b96 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2814,3 +2814,18 @@
\sa QApplication::setNavigationMode()
\sa QApplication::navigationMode()
*/
+
+/*!
+ \enum Qt::RenderHint
+ \since 4.6
+
+ This enum describes the possible hints that can be used to control various
+ rendering operations.
+
+ \value QualityHint Indicates that rendering quality is the most important factor,
+ at the potential cost of lower performance.
+
+ \value PerformanceHint Indicates that rendering performance is the most important factor,
+ at the potential cost of lower quality.
+*/
+
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 474af53..5fc61d7 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -796,7 +796,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)
: QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)
{
Q_D(QGraphicsBlurEffect);
- d->filter->setBlurHint(QPixmapBlurFilter::PerformanceHint);
+ d->filter->setBlurHint(Qt::PerformanceHint);
}
/*!
@@ -840,48 +840,34 @@ void QGraphicsBlurEffect::setBlurRadius(int radius)
*/
/*!
- \enum QGraphicsBlurEffect::BlurHint
-
- \since 4.6
-
- This enum describes the hint of a blur graphics effect.
-
- \value PerformanceHint Using this value hints that performance is the
- most important factor, at the potential cost of lower quality.
-
- \value QualityHint Using this value hints that a higher quality blur is
- preferred over a fast blur.
-*/
-
-/*!
\property QGraphicsBlurEffect::blurHint
\brief the blur hint of the effect.
- Use the PerformanceHint blur hint to say that you want a faster blur,
- and the QualityHint blur hint to say that you prefer a higher quality blur.
+ Use the Qt::PerformanceHint hint to say that you want a faster blur,
+ and the Qt::QualityHint hint to say that you prefer a higher quality blur.
- When animating the blur radius it's recommended to use the PerformanceHint.
+ When animating the blur radius it's recommended to use Qt::PerformanceHint.
- By default, the blur hint is PerformanceHint.
+ By default, the blur hint is Qt::PerformanceHint.
*/
-QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const
+Qt::RenderHint QGraphicsBlurEffect::blurHint() const
{
Q_D(const QGraphicsBlurEffect);
- return BlurHint(d->filter->blurHint());
+ return d->filter->blurHint();
}
-void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint)
+void QGraphicsBlurEffect::setBlurHint(Qt::RenderHint hint)
{
Q_D(QGraphicsBlurEffect);
- if (BlurHint(d->filter->blurHint()) == hint)
+ if (d->filter->blurHint() == hint)
return;
- d->filter->setBlurHint(QPixmapBlurFilter::BlurHint(hint));
+ d->filter->setBlurHint(hint);
emit blurHintChanged(hint);
}
/*!
- \fn void QGraphicsBlurEffect::blurHintChanged(QGraphicsBlurEffect::BlurHint hint)
+ \fn void QGraphicsBlurEffect::blurHintChanged(Qt::RenderHint hint)
This signal is emitted whenever the effect's blur hint changes.
The \a hint parameter holds the effect's new blur hint.
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index c2bb9b0..a92ce13 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -224,27 +224,22 @@ class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
- Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
+ Q_PROPERTY(Qt::RenderHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QGraphicsBlurEffect(QObject *parent = 0);
~QGraphicsBlurEffect();
QRectF boundingRectFor(const QRectF &rect) const;
int blurRadius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
public Q_SLOTS:
void setBlurRadius(int blurRadius);
- void setBlurHint(BlurHint blurHint);
+ void setBlurHint(Qt::RenderHint hint);
Q_SIGNALS:
void blurRadiusChanged(int blurRadius);
- void blurHintChanged(BlurHint blurHint);
+ void blurHintChanged(Qt::RenderHint hint);
protected:
void draw(QPainter *painter, QGraphicsEffectSource *source);
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index ba9a1e2..749b8f3 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -504,10 +504,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q
class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate
{
public:
- QPixmapBlurFilterPrivate() : radius(5), hint(QPixmapBlurFilter::PerformanceHint) {}
+ QPixmapBlurFilterPrivate() : radius(5), hint(Qt::PerformanceHint) {}
int radius;
- QPixmapBlurFilter::BlurHint hint;
+ Qt::RenderHint hint;
};
@@ -561,7 +561,7 @@ int QPixmapBlurFilter::radius() const
\internal
*/
-void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
+void QPixmapBlurFilter::setBlurHint(Qt::RenderHint hint)
{
Q_D(QPixmapBlurFilter);
d->hint = hint;
@@ -572,7 +572,7 @@ void QPixmapBlurFilter::setBlurHint(QPixmapBlurFilter::BlurHint hint)
\internal
*/
-QPixmapBlurFilter::BlurHint QPixmapBlurFilter::blurHint() const
+Qt::RenderHint QPixmapBlurFilter::blurHint() const
{
Q_D(const QPixmapBlurFilter);
return d->hint;
diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h
index 92c8e56..8a2207a 100644
--- a/src/gui/image/qpixmapfilter_p.h
+++ b/src/gui/image/qpixmapfilter_p.h
@@ -126,19 +126,14 @@ class Q_GUI_EXPORT QPixmapBlurFilter : public QPixmapFilter
Q_DECLARE_PRIVATE(QPixmapBlurFilter)
public:
- enum BlurHint {
- PerformanceHint,
- QualityHint
- };
-
QPixmapBlurFilter(QObject *parent = 0);
~QPixmapBlurFilter();
void setRadius(int radius);
- void setBlurHint(BlurHint hint);
+ void setBlurHint(Qt::RenderHint hint);
int radius() const;
- BlurHint blurHint() const;
+ Qt::RenderHint blurHint() const;
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const;
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 15714c2..1ae3866 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -100,7 +100,7 @@ private:
class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter>
{
public:
- QGLPixmapBlurFilter(QPixmapBlurFilter::BlurHint hint);
+ QGLPixmapBlurFilter(Qt::RenderHint hint);
void setUniforms(QGLShaderProgram *program);
@@ -115,7 +115,7 @@ private:
mutable bool m_haveCached;
mutable int m_cachedRadius;
- mutable QPixmapBlurFilter::BlurHint m_hint;
+ mutable Qt::RenderHint m_hint;
};
extern QGLWidget *qt_gl_share_widget();
@@ -131,13 +131,13 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr
case QPixmapFilter::BlurFilter: {
const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype);
- if (proto->blurHint() == QPixmapBlurFilter::PerformanceHint || proto->radius() <= 5) {
+ if (proto->blurHint() == Qt::PerformanceHint || proto->radius() <= 5) {
if (!d->fastBlurFilter)
- d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QPixmapBlurFilter::PerformanceHint));
+ d->fastBlurFilter.reset(new QGLPixmapBlurFilter(Qt::PerformanceHint));
return d->fastBlurFilter.data();
}
if (!d->blurFilter)
- d->blurFilter.reset(new QGLPixmapBlurFilter(QPixmapBlurFilter::QualityHint));
+ d->blurFilter.reset(new QGLPixmapBlurFilter(Qt::QualityHint));
return d->blurFilter.data();
}
@@ -279,12 +279,12 @@ static const char *qt_gl_blur_filter_fast =
" return color * (1.0 / float(samples));"
"}";
-QGLPixmapBlurFilter::QGLPixmapBlurFilter(QPixmapBlurFilter::BlurHint hint)
+QGLPixmapBlurFilter::QGLPixmapBlurFilter(Qt::RenderHint hint)
: m_haveCached(false)
, m_cachedRadius(5)
, m_hint(hint)
{
- if (hint == PerformanceHint) {
+ if (hint == Qt::PerformanceHint) {
QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
filter->setSource(qt_gl_blur_filter_fast);
m_haveCached = true;
@@ -296,7 +296,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
int radius = this->radius();
- if (!m_haveCached || (m_hint == QualityHint && radius != m_cachedRadius)) {
+ if (!m_haveCached || (m_hint == Qt::QualityHint && radius != m_cachedRadius)) {
// Only regenerate the shader from source if parameters have changed.
m_haveCached = true;
m_cachedRadius = radius;
@@ -358,7 +358,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program)
{
- if (m_hint == QualityHint) {
+ if (m_hint == Qt::QualityHint) {
if (m_horizontalBlur)
program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
else