qgraphicseffect.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/effects/qgraphicseffect.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40/*!-
41 \class QGraphicsEffect-
42 \brief The QGraphicsEffect class is the base class for all graphics-
43 effects.-
44 \since 4.6-
45 \ingroup multimedia-
46 \ingroup graphicsview-api-
47 \inmodule QtWidgets-
48-
49 Effects alter the appearance of elements by hooking into the rendering-
50 pipeline and operating between the source (e.g., a QGraphicsPixmapItem)-
51 and the destination device (e.g., QGraphicsView's viewport). Effects can be-
52 disabled by calling setEnabled(false). If effects are disabled, the source-
53 is rendered directly.-
54-
55 To add a visual effect to a QGraphicsItem, for example, you can use one of-
56 the standard effects, or alternately, create your own effect by creating a-
57 subclass of QGraphicsEffect. The effect can then be installed on the item-
58 using QGraphicsItem::setGraphicsEffect().-
59-
60 Qt provides the following standard effects:-
61-
62 \list-
63 \li QGraphicsBlurEffect - blurs the item by a given radius-
64 \li QGraphicsDropShadowEffect - renders a dropshadow behind the item-
65 \li QGraphicsColorizeEffect - renders the item in shades of any given color-
66 \li QGraphicsOpacityEffect - renders the item with an opacity-
67 \endlist-
68-
69 \table-
70 \row-
71 \li{2,1} \image graphicseffect-plain.png-
72 \row-
73 \li \image graphicseffect-blur.png-
74 \li \image graphicseffect-colorize.png-
75 \row-
76 \li \image graphicseffect-opacity.png-
77 \li \image graphicseffect-drop-shadow.png-
78 \endtable-
79-
80 \image graphicseffect-widget.png-
81-
82 For more information on how to use each effect, refer to the specific-
83 effect's documentation.-
84-
85 To create your own custom effect, create a subclass of QGraphicsEffect (or-
86 any other existing effects) and reimplement the virtual function draw().-
87 This function is called whenever the effect needs to redraw. The draw()-
88 function takes the painter with which to draw as an argument. For more-
89 information, refer to the documenation for draw(). In the draw() function-
90 you can call sourcePixmap() to get a pixmap of the graphics effect source-
91 which you can then process.-
92-
93 If your effect changes, use update() to request for a redraw. If your-
94 custom effect changes the bounding rectangle of the source, e.g., a radial-
95 glow effect may need to apply an extra margin, you can reimplement the-
96 virtual boundingRectFor() function, and call updateBoundingRect()-
97 to notify the framework whenever this rectangle changes. The virtual-
98 sourceChanged() function is called to notify the effects that-
99 the source has changed in some way - e.g., if the source is a-
100 QGraphicsRectItem and its rectangle parameters have changed.-
101-
102 \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect()-
103*/-
104-
105#include "qgraphicseffect_p.h"-
106#include "private/qgraphicsitem_p.h"-
107-
108#include <QtWidgets/qgraphicsitem.h>-
109-
110#include <QtGui/qimage.h>-
111#include <QtGui/qpainter.h>-
112#include <QtGui/qpaintengine.h>-
113#include <QtCore/qrect.h>-
114#include <QtCore/qdebug.h>-
115#include <private/qdrawhelper_p.h>-
116-
117#ifndef QT_NO_GRAPHICSEFFECT-
118QT_BEGIN_NAMESPACE-
119-
120QGraphicsEffectPrivate::~QGraphicsEffectPrivate()-
121{-
122}-
123-
124/*!-
125 \internal-
126 \class QGraphicsEffectSource-
127 \brief The QGraphicsEffectSource class represents the source on which a-
128 QGraphicsEffect is installed on.-
129-
130 When a QGraphicsEffect is installed on a QGraphicsItem, for example, this-
131 class will act as a wrapper around QGraphicsItem. Then, calling update() is-
132 effectively the same as calling QGraphicsItem::update().-
133-
134 QGraphicsEffectSource also provides a pixmap() function which creates a-
135 pixmap with the source painted into it.-
136-
137 \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect()-
138*/-
139-
140/*!-
141 \internal-
142*/-
143QGraphicsEffectSource::QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent)-
144 : QObject(dd, parent)-
145{}
never executed: end of block
0
146-
147/*!-
148 Destroys the effect source.-
149*/-
150QGraphicsEffectSource::~QGraphicsEffectSource()-
151{}-
152-
153/*!-
154 Returns the bounding rectangle of the source mapped to the given \a system.-
155-
156 \sa draw()-
157*/-
158QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const-
159{-
160 return d_func()->boundingRect(system);
never executed: return d_func()->boundingRect(system);
0
161}-
162-
163/*!-
164 Returns the bounding rectangle of the source mapped to the given \a system.-
165-
166 Calling this function with Qt::DeviceCoordinates outside of-
167 QGraphicsEffect::draw() will give undefined results, as there is no device-
168 context available.-
169-
170 \sa draw()-
171*/-
172QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const-
173{-
174 Q_D(const QGraphicsEffect);-
175 if (d->source)
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
176 return d->source->boundingRect(system);
never executed: return d->source->boundingRect(system);
0
177 return QRectF();
never executed: return QRectF();
0
178}-
179-
180/*!-
181 Returns a pointer to the item if this source is a QGraphicsItem; otherwise-
182 returns 0.-
183-
184 \sa widget()-
185*/-
186const QGraphicsItem *QGraphicsEffectSource::graphicsItem() const-
187{-
188 return d_func()->graphicsItem();
never executed: return d_func()->graphicsItem();
0
189}-
190-
191/*!-
192 Returns a pointer to the widget if this source is a QWidget; otherwise-
193 returns 0.-
194-
195 \sa graphicsItem()-
196*/-
197const QWidget *QGraphicsEffectSource::widget() const-
198{-
199 return d_func()->widget();
never executed: return d_func()->widget();
0
200}-
201-
202/*!-
203 Returns a pointer to the style options (used when drawing the source) if-
204 available; otherwise returns 0.-
205-
206 \sa graphicsItem(), widget()-
207*/-
208const QStyleOption *QGraphicsEffectSource::styleOption() const-
209{-
210 return d_func()->styleOption();
never executed: return d_func()->styleOption();
0
211}-
212-
213/*!-
214 Draws the source using the given \a painter.-
215-
216 This function should only be called from QGraphicsEffect::draw().-
217-
218 \sa QGraphicsEffect::draw()-
219*/-
220void QGraphicsEffectSource::draw(QPainter *painter)-
221{-
222 Q_D(const QGraphicsEffectSource);-
223-
224 QPixmap pm;-
225 if (QPixmapCache::find(d->m_cacheKey, &pm)) {
QPixmapCache::...cacheKey, &pm)Description
TRUEnever evaluated
FALSEnever evaluated
0
226 QTransform restoreTransform;-
227 if (d->m_cachedSystem == Qt::DeviceCoordinates) {
d->m_cachedSys...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
0
228 restoreTransform = painter->worldTransform();-
229 painter->setWorldTransform(QTransform());-
230 }
never executed: end of block
0
231-
232 painter->drawPixmap(d->m_cachedOffset, pm);-
233-
234 if (d->m_cachedSystem == Qt::DeviceCoordinates)
d->m_cachedSys...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
0
235 painter->setWorldTransform(restoreTransform);
never executed: painter->setWorldTransform(restoreTransform);
0
236 } else {
never executed: end of block
0
237 d_func()->draw(painter);-
238 }
never executed: end of block
0
239}-
240-
241/*!-
242 Draws the source directly using the given \a painter.-
243-
244 This function should only be called from QGraphicsEffect::draw().-
245-
246 For example:-
247-
248 \snippet code/src_gui_effects_qgraphicseffect.cpp 0-
249-
250 \sa QGraphicsEffect::draw()-
251*/-
252void QGraphicsEffect::drawSource(QPainter *painter)-
253{-
254 Q_D(const QGraphicsEffect);-
255 if (d->source)
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
256 d->source->draw(painter);
never executed: d->source->draw(painter);
0
257}
never executed: end of block
0
258-
259/*!-
260 Schedules a redraw of the source. Call this function whenever the source-
261 needs to be redrawn.-
262-
263 \sa QGraphicsEffect::updateBoundingRect(), QWidget::update(),-
264 QGraphicsItem::update(),-
265*/-
266void QGraphicsEffectSource::update()-
267{-
268 d_func()->update();-
269}
never executed: end of block
0
270-
271/*!-
272 Returns \c true if the source effectively is a pixmap, e.g., a-
273 QGraphicsPixmapItem.-
274-
275 This function is useful for optimization purposes. For instance, there's no-
276 point in drawing the source in device coordinates to avoid pixmap scaling-
277 if this function returns \c true - the source pixmap will be scaled anyways.-
278*/-
279bool QGraphicsEffectSource::isPixmap() const-
280{-
281 return d_func()->isPixmap();
never executed: return d_func()->isPixmap();
0
282}-
283-
284/*!-
285 Returns \c true if the source effectively is a pixmap, e.g., a-
286 QGraphicsPixmapItem.-
287-
288 This function is useful for optimization purposes. For instance, there's no-
289 point in drawing the source in device coordinates to avoid pixmap scaling-
290 if this function returns \c true - the source pixmap will be scaled anyways.-
291*/-
292bool QGraphicsEffect::sourceIsPixmap() const-
293{-
294 return source() ? source()->isPixmap() : false;
never executed: return source() ? source()->isPixmap() : false;
0
295}-
296-
297/*!-
298 Returns a pixmap with the source painted into it.-
299-
300 The \a system specifies which coordinate system to be used for the source.-
301 The optional \a offset parameter returns the offset where the pixmap should-
302 be painted at using the current painter.-
303-
304 The \a mode determines how much of the effect the pixmap will contain.-
305 By default, the pixmap will contain the whole effect.-
306-
307 The returned pixmap is bound to the current painter's device rectangle when-
308 \a system is Qt::DeviceCoordinates.-
309-
310 \sa QGraphicsEffect::draw(), boundingRect()-
311*/-
312QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const-
313{-
314 Q_D(const QGraphicsEffectSource);-
315-
316 // Shortcut, no cache for childless pixmap items...-
317 const QGraphicsItem *item = graphicsItem();-
318 if (system == Qt::LogicalCoordinates && mode == QGraphicsEffect::NoPad && item && isPixmap()) {
system == Qt::...calCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
mode == QGraphicsEffect::NoPadDescription
TRUEnever evaluated
FALSEnever evaluated
itemDescription
TRUEnever evaluated
FALSEnever evaluated
isPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
0
319 const QGraphicsPixmapItem *pixmapItem = static_cast<const QGraphicsPixmapItem *>(item);-
320 if (offset)
offsetDescription
TRUEnever evaluated
FALSEnever evaluated
0
321 *offset = pixmapItem->offset().toPoint();
never executed: *offset = pixmapItem->offset().toPoint();
0
322 return pixmapItem->pixmap();
never executed: return pixmapItem->pixmap();
0
323 }-
324-
325 if (Q_UNLIKELY(system == Qt::DeviceCoordinates && item &&
__builtin_expe...>info), false)Description
TRUEnever evaluated
FALSEnever evaluated
0
326 !static_cast<const QGraphicsItemEffectSourcePrivate *>(d_func())->info)) {-
327 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");-
328 return QPixmap();
never executed: return QPixmap();
0
329 }-
330-
331 QPixmap pm;-
332 if (item && d->m_cachedSystem == system && d->m_cachedMode == mode)
itemDescription
TRUEnever evaluated
FALSEnever evaluated
d->m_cachedSystem == systemDescription
TRUEnever evaluated
FALSEnever evaluated
d->m_cachedMode == modeDescription
TRUEnever evaluated
FALSEnever evaluated
0
333 QPixmapCache::find(d->m_cacheKey, &pm);
never executed: QPixmapCache::find(d->m_cacheKey, &pm);
0
334-
335 if (pm.isNull()) {
pm.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
336 pm = d->pixmap(system, &d->m_cachedOffset, mode);-
337 d->m_cachedSystem = system;-
338 d->m_cachedMode = mode;-
339-
340 d->invalidateCache();-
341 d->m_cacheKey = QPixmapCache::insert(pm);-
342 }
never executed: end of block
0
343-
344 if (offset)
offsetDescription
TRUEnever evaluated
FALSEnever evaluated
0
345 *offset = d->m_cachedOffset;
never executed: *offset = d->m_cachedOffset;
0
346-
347 return pm;
never executed: return pm;
0
348}-
349-
350/*!-
351 Returns a pixmap with the source painted into it.-
352-
353 The \a system specifies which coordinate system to be used for the source.-
354 The optional \a offset parameter returns the offset where the pixmap should-
355 be painted at using the current painter. For control on how the pixmap is-
356 padded use the \a mode parameter.-
357-
358 The returned pixmap is clipped to the current painter's device rectangle when-
359 \a system is Qt::DeviceCoordinates.-
360-
361 Calling this function with Qt::DeviceCoordinates outside of-
362 QGraphicsEffect::draw() will give undefined results, as there is no device-
363 context available.-
364-
365 \sa draw(), boundingRect()-
366*/-
367QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const-
368{-
369 Q_D(const QGraphicsEffect);-
370 if (d->source)
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
371 return d->source->pixmap(system, offset, mode);
never executed: return d->source->pixmap(system, offset, mode);
0
372 return QPixmap();
never executed: return QPixmap();
0
373}-
374-
375QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate()-
376{-
377 invalidateCache();-
378}
never executed: end of block
0
379-
380void QGraphicsEffectSourcePrivate::setCachedOffset(const QPoint &offset)-
381{-
382 m_cachedOffset = offset;-
383}
never executed: end of block
0
384-
385void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const-
386{-
387 if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect
m_cachedMode !...veBoundingRectDescription
TRUEnever evaluated
FALSEnever evaluated
0
388 && (reason == EffectRectChanged
reason == EffectRectChangedDescription
TRUEnever evaluated
FALSEnever evaluated
0
389 || (reason == TransformChanged && m_cachedSystem == Qt::LogicalCoordinates))) {
reason == TransformChangedDescription
TRUEnever evaluated
FALSEnever evaluated
m_cachedSystem...calCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
0
390 return;
never executed: return;
0
391 }-
392-
393 QPixmapCache::remove(m_cacheKey);-
394}
never executed: end of block
0
395-
396/*!-
397 Constructs a new QGraphicsEffect instance having the-
398 specified \a parent.-
399*/-
400QGraphicsEffect::QGraphicsEffect(QObject *parent)-
401 : QObject(*new QGraphicsEffectPrivate, parent)-
402{-
403}
never executed: end of block
0
404-
405/*!-
406 \internal-
407*/-
408QGraphicsEffect::QGraphicsEffect(QGraphicsEffectPrivate &dd, QObject *parent)-
409 : QObject(dd, parent)-
410{-
411}
never executed: end of block
0
412-
413/*!-
414 Removes the effect from the source, and destroys the graphics effect.-
415*/-
416QGraphicsEffect::~QGraphicsEffect()-
417{-
418 Q_D(QGraphicsEffect);-
419 d->setGraphicsEffectSource(0);-
420}
never executed: end of block
0
421-
422/*!-
423 Returns the effective bounding rectangle for this effect, i.e., the-
424 bounding rectangle of the source in device coordinates, adjusted by-
425 any margins applied by the effect itself.-
426-
427 \sa boundingRectFor(), updateBoundingRect()-
428*/-
429QRectF QGraphicsEffect::boundingRect() const-
430{-
431 Q_D(const QGraphicsEffect);-
432 if (d->source)
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
433 return boundingRectFor(d->source->boundingRect());
never executed: return boundingRectFor(d->source->boundingRect());
0
434 return QRectF();
never executed: return QRectF();
0
435}-
436-
437/*!-
438 Returns the effective bounding rectangle for this effect, given the-
439 provided \a rect in the device coordinates. When writing-
440 you own custom effect, you must call updateBoundingRect() whenever any-
441 parameters are changed that may cause this this function to return a-
442 different value.-
443-
444 \sa sourceBoundingRect()-
445*/-
446QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const-
447{-
448 return rect;
never executed: return rect;
0
449}-
450-
451/*!-
452 \property QGraphicsEffect::enabled-
453 \brief whether the effect is enabled or not.-
454-
455 If an effect is disabled, the source will be rendered with as normal, with-
456 no interference from the effect. If the effect is enabled, the source will-
457 be rendered with the effect applied.-
458-
459 This property is enabled by default.-
460-
461 Using this property, you can disable certain effects on slow platforms, in-
462 order to ensure that the user interface is responsive.-
463*/-
464bool QGraphicsEffect::isEnabled() const-
465{-
466 Q_D(const QGraphicsEffect);-
467 return d->isEnabled;
never executed: return d->isEnabled;
0
468}-
469-
470void QGraphicsEffect::setEnabled(bool enable)-
471{-
472 Q_D(QGraphicsEffect);-
473 if (d->isEnabled == enable)
d->isEnabled == enableDescription
TRUEnever evaluated
FALSEnever evaluated
0
474 return;
never executed: return;
0
475-
476 d->isEnabled = enable;-
477 if (d->source) {
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
478 d->source->d_func()->effectBoundingRectChanged();-
479 d->source->d_func()->invalidateCache();-
480 }
never executed: end of block
0
481 emit enabledChanged(enable);-
482}
never executed: end of block
0
483-
484/*!-
485 \fn void QGraphicsEffect::enabledChanged(bool enabled)-
486-
487 This signal is emitted whenever the effect is enabled or disabled.-
488 The \a enabled parameter holds the effects's new enabled state.-
489-
490 \sa isEnabled()-
491*/-
492-
493/*!-
494 Schedules a redraw of the effect. Call this function whenever the effect-
495 needs to be redrawn. This function does not trigger a redraw of the source.-
496-
497 \sa updateBoundingRect()-
498*/-
499void QGraphicsEffect::update()-
500{-
501 Q_D(QGraphicsEffect);-
502 if (d->source)
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
503 d->source->update();
never executed: d->source->update();
0
504}
never executed: end of block
0
505-
506/*!-
507 \internal-
508-
509 Returns a pointer to the source, which provides extra context information-
510 that can be useful for the effect.-
511-
512 \sa draw()-
513*/-
514QGraphicsEffectSource *QGraphicsEffect::source() const-
515{-
516 Q_D(const QGraphicsEffect);-
517 return d->source;
never executed: return d->source;
0
518}-
519-
520/*!-
521 This function notifies the effect framework when the effect's bounding-
522 rectangle has changed. As a custom effect author, you must call this-
523 function whenever you change any parameters that will cause the virtual-
524 boundingRectFor() function to return a different value.-
525-
526 This function will call update() if this is necessary.-
527-
528 \sa boundingRectFor(), boundingRect(), sourceBoundingRect()-
529*/-
530void QGraphicsEffect::updateBoundingRect()-
531{-
532 Q_D(QGraphicsEffect);-
533 if (d->source) {
d->sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
534 d->source->d_func()->effectBoundingRectChanged();-
535 d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged);-
536 }
never executed: end of block
0
537}
never executed: end of block
0
538-
539/*!-
540 \fn virtual void QGraphicsEffect::draw(QPainter *painter) = 0-
541-
542 This pure virtual function draws the effect and is called whenever the-
543 source needs to be drawn.-
544-
545 Reimplement this function in a QGraphicsEffect subclass to provide the-
546 effect's drawing implementation, using \a painter.-
547-
548 For example:-
549-
550 \snippet code/src_gui_effects_qgraphicseffect.cpp 1-
551-
552 This function should not be called explicitly by the user, since it is-
553 meant for reimplementation purposes only.-
554*/-
555-
556/*!-
557 \enum QGraphicsEffect::ChangeFlag-
558-
559 This enum describes what has changed in QGraphicsEffectSource.-
560-
561 \value SourceAttached The effect is installed on a source.-
562 \value SourceDetached The effect is uninstalled on a source.-
563 \value SourceBoundingRectChanged The bounding rect of the source has-
564 changed.-
565 \value SourceInvalidated The visual appearance of the source has changed.-
566*/-
567-
568/*!-
569 \enum QGraphicsEffect::PixmapPadMode-
570-
571 This enum describes how the pixmap returned from sourcePixmap should be-
572 padded.-
573-
574 \value NoPad The pixmap should not receive any additional-
575 padding.-
576 \value PadToTransparentBorder The pixmap should be padded-
577 to ensure it has a completely transparent border.-
578 \value PadToEffectiveBoundingRect The pixmap should be padded to-
579 match the effective bounding rectangle of the effect.-
580*/-
581-
582/*!-
583 This virtual function is called by QGraphicsEffect to notify the effect-
584 that the source has changed. If the effect applies any cache, then this-
585 cache must be purged in order to reflect the new appearance of the source.-
586-
587 The \a flags describes what has changed.-
588*/-
589void QGraphicsEffect::sourceChanged(ChangeFlags flags)-
590{-
591 Q_UNUSED(flags);-
592}
never executed: end of block
0
593-
594/*!-
595 \class QGraphicsColorizeEffect-
596 \brief The QGraphicsColorizeEffect class provides a colorize effect.-
597 \since 4.6-
598 \inmodule QtWidgets-
599-
600 A colorize effect renders the source with a tint of its color(). The color-
601 can be modified using the setColor() function.-
602-
603 By default, the color is light blue (QColor(0, 0, 192)).-
604-
605 \image graphicseffect-colorize.png-
606-
607 \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsOpacityEffect-
608*/-
609-
610/*!-
611 Constructs a new QGraphicsColorizeEffect instance.-
612 The \a parent parameter is passed to QGraphicsEffect's constructor.-
613*/-
614QGraphicsColorizeEffect::QGraphicsColorizeEffect(QObject *parent)-
615 : QGraphicsEffect(*new QGraphicsColorizeEffectPrivate, parent)-
616{-
617}
never executed: end of block
0
618-
619/*!-
620 Destroys the effect.-
621*/-
622QGraphicsColorizeEffect::~QGraphicsColorizeEffect()-
623{-
624}-
625-
626/*!-
627 \property QGraphicsColorizeEffect::color-
628 \brief the color of the effect.-
629-
630 By default, the color is light blue (QColor(0, 0, 192)).-
631*/-
632QColor QGraphicsColorizeEffect::color() const-
633{-
634 Q_D(const QGraphicsColorizeEffect);-
635 return d->filter->color();
never executed: return d->filter->color();
0
636}-
637-
638void QGraphicsColorizeEffect::setColor(const QColor &color)-
639{-
640 Q_D(QGraphicsColorizeEffect);-
641 if (d->filter->color() == color)
d->filter->color() == colorDescription
TRUEnever evaluated
FALSEnever evaluated
0
642 return;
never executed: return;
0
643-
644 d->filter->setColor(color);-
645 update();-
646 emit colorChanged(color);-
647}
never executed: end of block
0
648-
649/*!-
650 \property QGraphicsColorizeEffect::strength-
651 \brief the strength of the effect.-
652-
653 By default, the strength is 1.0.-
654 A strength 0.0 equals to no effect, while 1.0 means full colorization.-
655*/-
656qreal QGraphicsColorizeEffect::strength() const-
657{-
658 Q_D(const QGraphicsColorizeEffect);-
659 return d->filter->strength();
never executed: return d->filter->strength();
0
660}-
661-
662void QGraphicsColorizeEffect::setStrength(qreal strength)-
663{-
664 Q_D(QGraphicsColorizeEffect);-
665 if (qFuzzyCompare(d->filter->strength(), strength))
qFuzzyCompare(...h(), strength)Description
TRUEnever evaluated
FALSEnever evaluated
0
666 return;
never executed: return;
0
667-
668 d->filter->setStrength(strength);-
669 d->opaque = !qFuzzyIsNull(strength);-
670 update();-
671 emit strengthChanged(strength);-
672}
never executed: end of block
0
673-
674/*! \fn void QGraphicsColorizeEffect::strengthChanged(qreal strength)-
675 This signal is emitted whenever setStrength() changes the colorize-
676 strength property. \a strength contains the new strength value of-
677 the colorize effect.-
678 */-
679-
680/*!-
681 \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color)-
682-
683 This signal is emitted whenever the effect's color changes.-
684 The \a color parameter holds the effect's new color.-
685*/-
686-
687/*!-
688 \reimp-
689*/-
690void QGraphicsColorizeEffect::draw(QPainter *painter)-
691{-
692 Q_D(QGraphicsColorizeEffect);-
693-
694 if (!d->opaque) {
!d->opaqueDescription
TRUEnever evaluated
FALSEnever evaluated
0
695 drawSource(painter);-
696 return;
never executed: return;
0
697 }-
698-
699 QPoint offset;-
700 if (sourceIsPixmap()) {
sourceIsPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
0
701 // No point in drawing in device coordinates (pixmap will be scaled anyways).-
702 const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, NoPad);-
703 if (!pixmap.isNull())
!pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
704 d->filter->draw(painter, offset, pixmap);
never executed: d->filter->draw(painter, offset, pixmap);
0
705-
706 return;
never executed: return;
0
707 }-
708-
709 // Draw pixmap in deviceCoordinates to avoid pixmap scaling.-
710 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);-
711 if (pixmap.isNull())
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
712 return;
never executed: return;
0
713-
714 QTransform restoreTransform = painter->worldTransform();-
715 painter->setWorldTransform(QTransform());-
716 d->filter->draw(painter, offset, pixmap);-
717 painter->setWorldTransform(restoreTransform);-
718}
never executed: end of block
0
719-
720/*!-
721 \class QGraphicsBlurEffect-
722 \brief The QGraphicsBlurEffect class provides a blur effect.-
723 \since 4.6-
724 \inmodule QtWidgets-
725-
726 A blur effect blurs the source. This effect is useful for reducing details,-
727 such as when the source loses focus and you want to draw attention to other-
728 elements. The level of detail can be modified using the setBlurRadius()-
729 function. Use setBlurHints() to choose the blur hints.-
730-
731 By default, the blur radius is 5 pixels. The blur radius is specified in-
732 device coordinates.-
733-
734 \image graphicseffect-blur.png-
735-
736 \sa QGraphicsDropShadowEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect-
737*/-
738-
739/*!-
740 \enum QGraphicsBlurEffect::BlurHint-
741 \since 4.6-
742-
743 This enum describes the possible hints that can be used to control how-
744 blur effects are applied. The hints might not have an effect in all the-
745 paint engines.-
746-
747 \value PerformanceHint Indicates that rendering performance is the most important factor,-
748 at the potential cost of lower quality.-
749-
750 \value QualityHint Indicates that rendering quality is the most important factor,-
751 at the potential cost of lower performance.-
752-
753 \value AnimationHint Indicates that the blur radius is going to be animated, hinting-
754 that the implementation can keep a cache of blurred verisons of the source.-
755 Do not use this hint if the source is going to be dynamically changing.-
756-
757 \sa blurHints(), setBlurHints()-
758*/-
759-
760-
761/*!-
762 Constructs a new QGraphicsBlurEffect instance.-
763 The \a parent parameter is passed to QGraphicsEffect's constructor.-
764*/-
765QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent)-
766 : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent)-
767{-
768 Q_D(QGraphicsBlurEffect);-
769 d->filter->setBlurHints(QGraphicsBlurEffect::PerformanceHint);-
770}
never executed: end of block
0
771-
772/*!-
773 Destroys the effect.-
774*/-
775QGraphicsBlurEffect::~QGraphicsBlurEffect()-
776{-
777}-
778-
779/*!-
780 \property QGraphicsBlurEffect::blurRadius-
781 \brief the blur radius of the effect.-
782-
783 Using a smaller radius results in a sharper appearance, whereas a bigger-
784 radius results in a more blurred appearance.-
785-
786 By default, the blur radius is 5 pixels.-
787-
788 The radius is given in device coordinates, meaning it is-
789 unaffected by scale.-
790*/-
791qreal QGraphicsBlurEffect::blurRadius() const-
792{-
793 Q_D(const QGraphicsBlurEffect);-
794 return d->filter->radius();
never executed: return d->filter->radius();
0
795}-
796-
797void QGraphicsBlurEffect::setBlurRadius(qreal radius)-
798{-
799 Q_D(QGraphicsBlurEffect);-
800 if (qFuzzyCompare(d->filter->radius(), radius))
qFuzzyCompare(...ius(), radius)Description
TRUEnever evaluated
FALSEnever evaluated
0
801 return;
never executed: return;
0
802-
803 d->filter->setRadius(radius);-
804 updateBoundingRect();-
805 emit blurRadiusChanged(radius);-
806}
never executed: end of block
0
807-
808/*!-
809 \fn void QGraphicsBlurEffect::blurRadiusChanged(qreal radius)-
810-
811 This signal is emitted whenever the effect's blur radius changes.-
812 The \a radius parameter holds the effect's new blur radius.-
813*/-
814-
815/*!-
816 \property QGraphicsBlurEffect::blurHints-
817 \brief the blur hint of the effect.-
818-
819 Use the PerformanceHint hint to say that you want a faster blur,-
820 the QualityHint hint to say that you prefer a higher quality blur,-
821 or the AnimationHint when you want to animate the blur radius.-
822-
823 By default, the blur hint is PerformanceHint.-
824*/-
825QGraphicsBlurEffect::BlurHints QGraphicsBlurEffect::blurHints() const-
826{-
827 Q_D(const QGraphicsBlurEffect);-
828 return d->filter->blurHints();
never executed: return d->filter->blurHints();
0
829}-
830-
831void QGraphicsBlurEffect::setBlurHints(QGraphicsBlurEffect::BlurHints hints)-
832{-
833 Q_D(QGraphicsBlurEffect);-
834 if (d->filter->blurHints() == hints)
d->filter->blu...nts() == hintsDescription
TRUEnever evaluated
FALSEnever evaluated
0
835 return;
never executed: return;
0
836-
837 d->filter->setBlurHints(hints);-
838 emit blurHintsChanged(hints);-
839}
never executed: end of block
0
840-
841/*!-
842 \fn void QGraphicsBlurEffect::blurHintsChanged(QGraphicsBlurEffect::BlurHints hints)-
843-
844 This signal is emitted whenever the effect's blur hints changes.-
845 The \a hints parameter holds the effect's new blur hints.-
846*/-
847-
848/*!-
849 \reimp-
850*/-
851QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const-
852{-
853 Q_D(const QGraphicsBlurEffect);-
854 return d->filter->boundingRectFor(rect);
never executed: return d->filter->boundingRectFor(rect);
0
855}-
856-
857/*!-
858 \reimp-
859*/-
860void QGraphicsBlurEffect::draw(QPainter *painter)-
861{-
862 Q_D(QGraphicsBlurEffect);-
863 if (d->filter->radius() < 1) {
d->filter->radius() < 1Description
TRUEnever evaluated
FALSEnever evaluated
0
864 drawSource(painter);-
865 return;
never executed: return;
0
866 }-
867-
868 PixmapPadMode mode = PadToEffectiveBoundingRect;-
869-
870 QPoint offset;-
871 QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, mode);-
872 if (pixmap.isNull())
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
873 return;
never executed: return;
0
874-
875 d->filter->draw(painter, offset, pixmap);-
876}
never executed: end of block
0
877-
878/*!-
879 \class QGraphicsDropShadowEffect-
880 \brief The QGraphicsDropShadowEffect class provides a drop shadow effect.-
881 \since 4.6-
882 \inmodule QtWidgets-
883-
884 A drop shadow effect renders the source with a drop shadow. The color of-
885 the drop shadow can be modified using the setColor() function. The drop-
886 shadow offset can be modified using the setOffset() function and the blur-
887 radius of the drop shadow can be changed with the setBlurRadius()-
888 function.-
889-
890 By default, the drop shadow is a semi-transparent dark gray-
891 (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset-
892 of 8 pixels towards the lower right. The drop shadow offset is specified-
893 in device coordinates.-
894-
895 \image graphicseffect-drop-shadow.png-
896-
897 \sa QGraphicsBlurEffect, QGraphicsColorizeEffect, QGraphicsOpacityEffect-
898*/-
899-
900/*!-
901 Constructs a new QGraphicsDropShadowEffect instance.-
902 The \a parent parameter is passed to QGraphicsEffect's constructor.-
903*/-
904QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent)-
905 : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent)-
906{-
907}
never executed: end of block
0
908-
909/*!-
910 Destroys the effect.-
911*/-
912QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()-
913{-
914}-
915-
916/*!-
917 \property QGraphicsDropShadowEffect::offset-
918 \brief the shadow offset in pixels.-
919-
920 By default, the offset is 8 pixels towards the lower right.-
921-
922 The offset is given in device coordinates, which means it is-
923 unaffected by scale.-
924-
925 \sa xOffset(), yOffset(), blurRadius(), color()-
926*/-
927QPointF QGraphicsDropShadowEffect::offset() const-
928{-
929 Q_D(const QGraphicsDropShadowEffect);-
930 return d->filter->offset();
never executed: return d->filter->offset();
0
931}-
932-
933void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)-
934{-
935 Q_D(QGraphicsDropShadowEffect);-
936 if (d->filter->offset() == offset)
d->filter->offset() == offsetDescription
TRUEnever evaluated
FALSEnever evaluated
0
937 return;
never executed: return;
0
938-
939 d->filter->setOffset(offset);-
940 updateBoundingRect();-
941 emit offsetChanged(offset);-
942}
never executed: end of block
0
943-
944/*!-
945 \property QGraphicsDropShadowEffect::xOffset-
946 \brief the horizontal shadow offset in pixels.-
947-
948 By default, the horizontal shadow offset is 8 pixels.-
949-
950-
951-
952 \sa yOffset(), offset()-
953*/-
954-
955/*!-
956 \property QGraphicsDropShadowEffect::yOffset-
957 \brief the vertical shadow offset in pixels.-
958-
959 By default, the vertical shadow offset is 8 pixels.-
960-
961 \sa xOffset(), offset()-
962*/-
963-
964/*!-
965 \fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset)-
966-
967 This signal is emitted whenever the effect's shadow offset changes.-
968 The \a offset parameter holds the effect's new shadow offset.-
969*/-
970-
971/*!-
972 \property QGraphicsDropShadowEffect::blurRadius-
973 \brief the blur radius in pixels of the drop shadow.-
974-
975 Using a smaller radius results in a sharper shadow, whereas using a bigger-
976 radius results in a more blurred shadow.-
977-
978 By default, the blur radius is 1 pixel.-
979-
980 \sa color(), offset()-
981*/-
982qreal QGraphicsDropShadowEffect::blurRadius() const-
983{-
984 Q_D(const QGraphicsDropShadowEffect);-
985 return d->filter->blurRadius();
never executed: return d->filter->blurRadius();
0
986}-
987-
988void QGraphicsDropShadowEffect::setBlurRadius(qreal blurRadius)-
989{-
990 Q_D(QGraphicsDropShadowEffect);-
991 if (qFuzzyCompare(d->filter->blurRadius(), blurRadius))
qFuzzyCompare(...), blurRadius)Description
TRUEnever evaluated
FALSEnever evaluated
0
992 return;
never executed: return;
0
993-
994 d->filter->setBlurRadius(blurRadius);-
995 updateBoundingRect();-
996 emit blurRadiusChanged(blurRadius);-
997}
never executed: end of block
0
998-
999/*!-
1000 \fn void QGraphicsDropShadowEffect::blurRadiusChanged(qreal blurRadius)-
1001-
1002 This signal is emitted whenever the effect's blur radius changes.-
1003 The \a blurRadius parameter holds the effect's new blur radius.-
1004*/-
1005-
1006/*!-
1007 \property QGraphicsDropShadowEffect::color-
1008 \brief the color of the drop shadow.-
1009-
1010 By default, the drop color is a semi-transparent dark gray-
1011 (QColor(63, 63, 63, 180)).-
1012-
1013 \sa offset(), blurRadius()-
1014*/-
1015QColor QGraphicsDropShadowEffect::color() const-
1016{-
1017 Q_D(const QGraphicsDropShadowEffect);-
1018 return d->filter->color();
never executed: return d->filter->color();
0
1019}-
1020-
1021void QGraphicsDropShadowEffect::setColor(const QColor &color)-
1022{-
1023 Q_D(QGraphicsDropShadowEffect);-
1024 if (d->filter->color() == color)
d->filter->color() == colorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1025 return;
never executed: return;
0
1026-
1027 d->filter->setColor(color);-
1028 update();-
1029 emit colorChanged(color);-
1030}
never executed: end of block
0
1031-
1032/*!-
1033 \fn void QGraphicsDropShadowEffect::colorChanged(const QColor &color)-
1034-
1035 This signal is emitted whenever the effect's color changes.-
1036 The \a color parameter holds the effect's new color.-
1037*/-
1038-
1039/*!-
1040 \reimp-
1041*/-
1042QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const-
1043{-
1044 Q_D(const QGraphicsDropShadowEffect);-
1045 return d->filter->boundingRectFor(rect);
never executed: return d->filter->boundingRectFor(rect);
0
1046}-
1047-
1048/*!-
1049 \reimp-
1050*/-
1051void QGraphicsDropShadowEffect::draw(QPainter *painter)-
1052{-
1053 Q_D(QGraphicsDropShadowEffect);-
1054 if (d->filter->blurRadius() <= 0 && d->filter->offset().isNull()) {
d->filter->blurRadius() <= 0Description
TRUEnever evaluated
FALSEnever evaluated
d->filter->offset().isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1055 drawSource(painter);-
1056 return;
never executed: return;
0
1057 }-
1058-
1059 PixmapPadMode mode = PadToEffectiveBoundingRect;-
1060-
1061 // Draw pixmap in device coordinates to avoid pixmap scaling.-
1062 QPoint offset;-
1063 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode);-
1064 if (pixmap.isNull())
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1065 return;
never executed: return;
0
1066-
1067 QTransform restoreTransform = painter->worldTransform();-
1068 painter->setWorldTransform(QTransform());-
1069 d->filter->draw(painter, offset, pixmap);-
1070 painter->setWorldTransform(restoreTransform);-
1071}
never executed: end of block
0
1072-
1073/*!-
1074 \class QGraphicsOpacityEffect-
1075 \brief The QGraphicsOpacityEffect class provides an opacity effect.-
1076 \since 4.6-
1077 \inmodule QtWidgets-
1078-
1079 An opacity effect renders the source with an opacity. This effect is useful-
1080 for making the source semi-transparent, similar to a fade-in/fade-out-
1081 sequence. The opacity can be modified using the setOpacity() function.-
1082-
1083 By default, the opacity is 0.7.-
1084-
1085 \image graphicseffect-opacity.png-
1086-
1087 \sa QGraphicsDropShadowEffect, QGraphicsBlurEffect, QGraphicsColorizeEffect-
1088*/-
1089-
1090/*!-
1091 Constructs a new QGraphicsOpacityEffect instance.-
1092 The \a parent parameter is passed to QGraphicsEffect's constructor.-
1093*/-
1094QGraphicsOpacityEffect::QGraphicsOpacityEffect(QObject *parent)-
1095 : QGraphicsEffect(*new QGraphicsOpacityEffectPrivate, parent)-
1096{-
1097}
never executed: end of block
0
1098-
1099/*!-
1100 Destroys the effect.-
1101*/-
1102QGraphicsOpacityEffect::~QGraphicsOpacityEffect()-
1103{-
1104}-
1105-
1106/*!-
1107 \property QGraphicsOpacityEffect::opacity-
1108 \brief the opacity of the effect.-
1109-
1110 The value should be in the range of 0.0 to 1.0, where 0.0 is-
1111 fully transparent and 1.0 is fully opaque.-
1112-
1113 By default, the opacity is 0.7.-
1114-
1115 \sa setOpacityMask()-
1116*/-
1117qreal QGraphicsOpacityEffect::opacity() const-
1118{-
1119 Q_D(const QGraphicsOpacityEffect);-
1120 return d->opacity;
never executed: return d->opacity;
0
1121}-
1122-
1123void QGraphicsOpacityEffect::setOpacity(qreal opacity)-
1124{-
1125 Q_D(QGraphicsOpacityEffect);-
1126 opacity = qBound(qreal(0.0), opacity, qreal(1.0));-
1127-
1128 if (qFuzzyCompare(d->opacity, opacity))
qFuzzyCompare(...city, opacity)Description
TRUEnever evaluated
FALSEnever evaluated
0
1129 return;
never executed: return;
0
1130-
1131 d->opacity = opacity;-
1132 if ((d->isFullyTransparent = qFuzzyIsNull(d->opacity)))
(d->isFullyTra...l(d->opacity))Description
TRUEnever evaluated
FALSEnever evaluated
0
1133 d->isFullyOpaque = 0;
never executed: d->isFullyOpaque = 0;
0
1134 else-
1135 d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
never executed: d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
0
1136 update();-
1137 emit opacityChanged(opacity);-
1138}
never executed: end of block
0
1139-
1140/*!-
1141 \fn void QGraphicsOpacityEffect::opacityChanged(qreal opacity)-
1142-
1143 This signal is emitted whenever the effect's opacity changes.-
1144 The \a opacity parameter holds the effect's new opacity.-
1145*/-
1146-
1147/*!-
1148 \property QGraphicsOpacityEffect::opacityMask-
1149 \brief the opacity mask of the effect.-
1150-
1151 An opacity mask allows you apply opacity to portions of an element.-
1152-
1153 For example:-
1154-
1155 \snippet code/src_gui_effects_qgraphicseffect.cpp 2-
1156-
1157 There is no opacity mask by default.-
1158-
1159 \sa setOpacity()-
1160*/-
1161QBrush QGraphicsOpacityEffect::opacityMask() const-
1162{-
1163 Q_D(const QGraphicsOpacityEffect);-
1164 return d->opacityMask;
never executed: return d->opacityMask;
0
1165}-
1166-
1167void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask)-
1168{-
1169 Q_D(QGraphicsOpacityEffect);-
1170 if (d->opacityMask == mask)
d->opacityMask == maskDescription
TRUEnever evaluated
FALSEnever evaluated
0
1171 return;
never executed: return;
0
1172-
1173 d->opacityMask = mask;-
1174 d->hasOpacityMask = (mask.style() != Qt::NoBrush);-
1175 update();-
1176-
1177 emit opacityMaskChanged(mask);-
1178}
never executed: end of block
0
1179-
1180/*!-
1181 \fn void QGraphicsOpacityEffect::opacityMaskChanged(const QBrush &mask)-
1182-
1183 This signal is emitted whenever the effect's opacity mask changes.-
1184 The \a mask parameter holds the effect's new opacity mask.-
1185*/-
1186-
1187/*!-
1188 \reimp-
1189*/-
1190void QGraphicsOpacityEffect::draw(QPainter *painter)-
1191{-
1192 Q_D(QGraphicsOpacityEffect);-
1193-
1194 // Transparent; nothing to draw.-
1195 if (d->isFullyTransparent)
d->isFullyTransparentDescription
TRUEnever evaluated
FALSEnever evaluated
0
1196 return;
never executed: return;
0
1197-
1198 // Opaque; draw directly without going through a pixmap.-
1199 if (d->isFullyOpaque && !d->hasOpacityMask) {
d->isFullyOpaqueDescription
TRUEnever evaluated
FALSEnever evaluated
!d->hasOpacityMaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
1200 drawSource(painter);-
1201 return;
never executed: return;
0
1202 }-
1203-
1204 QPoint offset;-
1205 Qt::CoordinateSystem system = sourceIsPixmap() ? Qt::LogicalCoordinates : Qt::DeviceCoordinates;
sourceIsPixmap()Description
TRUEnever evaluated
FALSEnever evaluated
0
1206 QPixmap pixmap = sourcePixmap(system, &offset, QGraphicsEffect::NoPad);-
1207 if (pixmap.isNull())
pixmap.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1208 return;
never executed: return;
0
1209-
1210 painter->save();-
1211 painter->setOpacity(d->opacity);-
1212-
1213 if (d->hasOpacityMask) {
d->hasOpacityMaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
1214 QPainter pixmapPainter(&pixmap);-
1215 pixmapPainter.setRenderHints(painter->renderHints());-
1216 pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);-
1217 if (system == Qt::DeviceCoordinates) {
system == Qt::...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
0
1218 QTransform worldTransform = painter->worldTransform();-
1219 worldTransform *= QTransform::fromTranslate(-offset.x(), -offset.y());-
1220 pixmapPainter.setWorldTransform(worldTransform);-
1221 pixmapPainter.fillRect(sourceBoundingRect(), d->opacityMask);-
1222 } else {
never executed: end of block
0
1223 pixmapPainter.translate(-offset);-
1224 pixmapPainter.fillRect(pixmap.rect(), d->opacityMask);-
1225 }
never executed: end of block
0
1226 }-
1227-
1228 if (system == Qt::DeviceCoordinates)
system == Qt::...iceCoordinatesDescription
TRUEnever evaluated
FALSEnever evaluated
0
1229 painter->setWorldTransform(QTransform());
never executed: painter->setWorldTransform(QTransform());
0
1230-
1231 painter->drawPixmap(offset, pixmap);-
1232 painter->restore();-
1233}
never executed: end of block
0
1234-
1235-
1236QT_END_NAMESPACE-
1237-
1238#include "moc_qgraphicseffect.cpp"-
1239#include "moc_qgraphicseffect_p.cpp"-
1240-
1241#endif //QT_NO_GRAPHICSEFFECT-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9