diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-24 20:20:56 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-24 20:20:56 (GMT) |
commit | e4002434bfde5c8206463ea3a0d4140835619944 (patch) | |
tree | f199a1e233867ab4e85d22aa138391585af75fca /doc/src | |
parent | 3f183debfd677b952b015f6950131dd25bd4768b (diff) | |
parent | 5a7c14af3c27089b0b8698da3c689637ffaa9cfa (diff) | |
download | Qt-e4002434bfde5c8206463ea3a0d4140835619944.zip Qt-e4002434bfde5c8206463ea3a0d4140835619944.tar.gz Qt-e4002434bfde5c8206463ea3a0d4140835619944.tar.bz2 |
Merge branch '4.6'
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/examples/tablet.qdoc | 2 | ||||
-rw-r--r-- | doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc index 3b2caf3..95acc69 100644 --- a/doc/src/examples/tablet.qdoc +++ b/doc/src/examples/tablet.qdoc @@ -48,7 +48,7 @@ \image tabletexample.png When you use a tablet with Qt applications, \l{QTabletEvent}s are - genarated. You need to reimplement the + generated. You need to reimplement the \l{QWidget::}{tabletEvent()} event handler if you want to handle tablet events. Events are generated when the device used for drawing enters and leaves the proximity of the tablet (i.e., when diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp new file mode 100644 index 0000000..6265c80 --- /dev/null +++ b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp @@ -0,0 +1,33 @@ +//! [0] +MyGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +{ + // Fully opaque; draw directly without going through a pixmap. + if (qFuzzyCompare(m_opacity, 1)) { + source->draw(painter); + return; + } + ... +} +//! [0] + +//! [1] +MyGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +{ + ... + QPoint offset; + if (source->isPixmap()) { + // No point in drawing in device coordinates (pixmap will be scaled anyways). + const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + ... + painter->drawPixmap(offset, pixmap); + } else { + // Draw pixmap in device coordinates to avoid pixmap scaling; + const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + painter->setWorldTransform(QTransform()); + ... + painter->drawPixmap(offset, pixmap); + } + ... +} +//! [1] + |