summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-28 08:31:31 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-28 14:34:16 (GMT)
commitd6d49aa56750359012cdf722df27b0a1c3e5b2aa (patch)
treeeac4337828535ff4b8f120ffb03b77efd5a0d812 /doc/src
parentc3df6e12309164a6fa0cf76546a354c5d59c5374 (diff)
downloadQt-d6d49aa56750359012cdf722df27b0a1c3e5b2aa.zip
Qt-d6d49aa56750359012cdf722df27b0a1c3e5b2aa.tar.gz
Qt-d6d49aa56750359012cdf722df27b0a1c3e5b2aa.tar.bz2
Add support for setting an opacity mask on QGraphicsOpacityEffect.
Opacity masks enable you to make portions of an element transparent. More information about opacity masks here: http://msdn.microsoft.com/en-us/library/ms743320.aspx Reviewed-by: Samuel
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp
index 6265c80..152b04f 100644
--- a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp
+++ b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp
@@ -31,3 +31,13 @@ MyGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
}
//! [1]
+//! [2]
+...
+QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft());
+alphaGradient.setColorAt(0.0, Qt::transparent);
+alphaGradient.setColorAt(0.5, Qt::black);
+alphaGradient.setColorAt(1.0, Qt::transparent);
+QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
+effect->setOpacityMask(alphaGradient);
+...
+//! [2]