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.

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 homogenously 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 dropshadow should apear. 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);

Member Function Documentation

QPixmapDropShadowFilter::QPixmapDropShadowFilter ()

Constructs drop shadow filter.

QPixmapDropShadowFilter::~QPixmapDropShadowFilter ()

Destroys drop shadow filter.

qreal QPixmapDropShadowFilter::blurRadius () const

Gets the radius in pixels of the blur on the drop shadow. Smaller radius means sharper shadow.

See also setBlurRadius().

QRectF QPixmapDropShadowFilter::boundingRectFor ( const QRectF & rect ) const   [virtual]

Reimplemented from QPixmapFilter.

QColor QPixmapDropShadowFilter::color () const

Gets the color of the drop shadow.

See also setColor().

void QPixmapDropShadowFilter::draw ( QPainter * p, const QPointF & pos, const QPixmap & px, const QRectF & src = QRectF() ) const   [virtual]

Reimplemented from QPixmapFilter.

QPointF QPixmapDropShadowFilter::offset () const

Gets the shadow offset in pixels.

See also setOffset().

void QPixmapDropShadowFilter::setBlurRadius ( qreal radius )

Sets the radius in pixels of the blur on the drop shadow. Smaller radius means sharper shadow.

See also blurRadius().

void QPixmapDropShadowFilter::setColor ( const QColor & color )

Sets the color of the drop shadow.

See also color().

void QPixmapDropShadowFilter::setOffset ( const QPointF & offset )

Sets shadow the offset in pixels.

See also offset().

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

This is an overloaded member function, provided for convenience.


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