Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions

QPixmapDropShadowFilter Class Reference
[QtGui module]

The QPixmapDropShadowFilter class is a convenience class for drawing pixmaps with drop shadows. More...

 #include <QPixmapDropShadowFilter>

Inherits QPixmapFilter.

This class was introduced in Qt 4.5.

Public Functions


Detailed Description

The QPixmapDropShadowFilter class is a convenience class for drawing pixmaps with drop shadows.

The drop shadow is produced by taking a copy of the source pixmap and applying a color to the copy using a QPainter::CompositionMode_DestinationIn operation. This produces a homogeneously-colored pixmap which is then drawn using a QPixmapConvolutionFilter at an offset. The original pixmap is drawn on top.

The QPixmapDropShadowFilter class provides some customization options to specify how the drop shadow should appear. The color of the drop shadow can be modified using the setColor() function, the drop shadow offset can be modified using the setOffset() function, and the blur radius of the drop shadow can be changed through the setBlurRadius() function.

By default, the drop shadow is a dark gray shadow, blurred with a radius of 1 at an offset of 8 pixels towards the lower right.

Example:

 QPixmapDropShadowFilter *myFilter = new QPixmapDropShadowFilter;
 myFilter->draw(painter, QPoint(0, 0), originalPixmap);

See also QPixmapColorizeFilter and QPixmapConvolutionFilter.


Member Function Documentation

QPixmapDropShadowFilter::QPixmapDropShadowFilter ()

Constructs drop shadow filter.

QPixmapDropShadowFilter::~QPixmapDropShadowFilter ()

Destroys drop shadow filter.

qreal QPixmapDropShadowFilter::blurRadius () const

Returns the radius in pixels of the blur on the drop shadow.

A smaller radius results in a sharper shadow.

See also setBlurRadius(), color(), and offset().

QColor QPixmapDropShadowFilter::color () const

Returns the color of the drop shadow.

See also setColor(), blurRadius(), and offset().

QPointF QPixmapDropShadowFilter::offset () const

Returns the shadow offset in pixels.

See also setOffset(), blurRadius(), and color().

void QPixmapDropShadowFilter::setBlurRadius ( qreal radius )

Sets the radius in pixels of the blur on the drop shadow to the radius specified.

Using a smaller radius results in a sharper shadow.

See also blurRadius(), setColor(), and setOffset().

void QPixmapDropShadowFilter::setColor ( const QColor & color )

Sets the color of the drop shadow to the color specified.

See also color(), setBlurRadius(), and setOffset().

void QPixmapDropShadowFilter::setOffset ( const QPointF & offset )

Sets the shadow offset in pixels to the offset specified.

See also offset(), setBlurRadius(), and setColor().

void QPixmapDropShadowFilter::setOffset ( qreal dx, qreal dy )

This is an overloaded member function, provided for convenience.

Sets the shadow offset in pixels to be the displacement specified by the horizontal dx and vertical dy coordinates.

See also setBlurRadius() and setColor().


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.5.0-rc1