Qt 4.8
Public Functions | Public Variables | List of all members
QGraphicsItemEffectSourcePrivate Class Reference

#include <qgraphicsitem_p.h>

Inheritance diagram for QGraphicsItemEffectSourcePrivate:
QGraphicsEffectSourcePrivate QObjectPrivate QObjectData

Public Functions

QRectF boundingRect (Qt::CoordinateSystem system) const
 
void detach ()
 
QRect deviceRect () const
 
void draw (QPainter *)
 
void effectBoundingRectChanged ()
 
const QGraphicsItemgraphicsItem () const
 
bool isPixmap () const
 
QRect paddedEffectRect (Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded=0) const
 
QPixmap pixmap (Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const
 
 QGraphicsItemEffectSourcePrivate (QGraphicsItem *i)
 
const QStyleOptionstyleOption () const
 
void update ()
 
const QWidgetwidget () const
 
- Public Functions inherited from QGraphicsEffectSourcePrivate
QGraphicsEffect::PixmapPadMode currentCachedMode () const
 
Qt::CoordinateSystem currentCachedSystem () const
 
void invalidateCache (InvalidateReason reason=SourceChanged) const
 
 QGraphicsEffectSourcePrivate ()
 
void setCachedOffset (const QPoint &offset)
 
virtual ~QGraphicsEffectSourcePrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QGraphicsItemPaintInfoinfo
 
QGraphicsItemitem
 
QTransform lastEffectTransform
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QGraphicsEffectSourcePrivate
enum  InvalidateReason { TransformChanged, EffectRectChanged, SourceChanged }
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 662 of file qgraphicsitem_p.h.

Constructors and Destructors

◆ QGraphicsItemEffectSourcePrivate()

QGraphicsItemEffectSourcePrivate::QGraphicsItemEffectSourcePrivate ( QGraphicsItem i)
inline

Definition at line 665 of file qgraphicsitem_p.h.

Functions

◆ boundingRect()

QRectF QGraphicsItemEffectSourcePrivate::boundingRect ( Qt::CoordinateSystem  system) const
virtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 11803 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive().

11804 {
11805  const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
11806  if (!info && deviceCoordinates) {
11807  // Device coordinates without info not yet supported.
11808  qWarning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
11809  return QRectF();
11810  }
11811 
11812  QRectF rect = item->boundingRect();
11813  if (!item->d_ptr->children.isEmpty())
11814  rect |= item->childrenBoundingRect();
11815 
11816  if (deviceCoordinates) {
11817  Q_ASSERT(info->painter);
11818  rect = info->painter->worldTransform().mapRect(rect);
11819  }
11820 
11821  return rect;
11822 }
QRectF childrenBoundingRect() const
Returns the bounding rect of this item&#39;s descendants (i.e., its children, their children, etc.) in local coordinates.
QScopedPointer< QGraphicsItemPrivate > d_ptr
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Q_CORE_EXPORT void qWarning(const char *,...)
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
QGraphicsItemPaintInfo * info
QList< QGraphicsItem * > children

◆ detach()

void QGraphicsItemEffectSourcePrivate::detach ( )
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 669 of file qgraphicsitem_p.h.

670  {
671  item->d_ptr->graphicsEffect = 0;
673  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsEffect * graphicsEffect
void prepareGeometryChange()
Prepares the item for a geometry change.

◆ deviceRect()

QRect QGraphicsItemEffectSourcePrivate::deviceRect ( ) const
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 701 of file qgraphicsitem_p.h.

702  {
703  if (!info || !info->widget) {
704  qWarning("QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context");
705  return QRect();
706  }
707  return info->widget->rect();
708  }
Q_CORE_EXPORT void qWarning(const char *,...)
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QGraphicsItemPaintInfo * info

◆ draw()

void QGraphicsItemEffectSourcePrivate::draw ( QPainter painter)
virtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 11824 of file qgraphicsitem.cpp.

11825 {
11826  if (!info) {
11827  qWarning("QGraphicsEffectSource::draw: Can only begin as a result of QGraphicsEffect::draw");
11828  return;
11829  }
11830 
11831  Q_ASSERT(item->d_ptr->scene);
11832  QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
11833  if (painter == info->painter) {
11834  scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion,
11836  info->drawItem);
11837  } else {
11838  QTransform effectTransform = info->painter->worldTransform().inverted();
11839  effectTransform *= painter->worldTransform();
11840  scened->draw(item, painter, info->viewTransform, info->transformPtr, info->exposedRegion,
11841  info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform,
11842  info->drawItem);
11843  }
11844 }
const QTransform * transformPtr
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsScene * scene
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
Q_CORE_EXPORT void qWarning(const char *,...)
const QTransform * viewTransform
const QTransform * effectTransform
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
QGraphicsItemPaintInfo * info
void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const, QRegion *, QWidget *, qreal, const QTransform *const, bool, bool)
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ effectBoundingRectChanged()

void QGraphicsItemEffectSourcePrivate::effectBoundingRectChanged ( )
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 687 of file qgraphicsitem_p.h.

void prepareGeometryChange()
Prepares the item for a geometry change.

◆ graphicsItem()

const QGraphicsItem* QGraphicsItemEffectSourcePrivate::graphicsItem ( ) const
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 675 of file qgraphicsitem_p.h.

676  { return item; }

◆ isPixmap()

bool QGraphicsItemEffectSourcePrivate::isPixmap ( ) const
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 690 of file qgraphicsitem_p.h.

691  {
692  return item->type() == QGraphicsPixmapItem::Type
694  && item->d_ptr->children.size() == 0;
695  //|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func()));
696  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
virtual int type() const
Returns the type of an item as an int.
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ paddedEffectRect()

QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect ( Qt::CoordinateSystem  system,
QGraphicsEffect::PixmapPadMode  mode,
const QRectF sourceRect,
bool *  unpadded = 0 
) const

Definition at line 11847 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive().

11848 {
11849  QRectF effectRectF;
11850 
11851  if (unpadded)
11852  *unpadded = false;
11853 
11855  if (info) {
11856  QRectF deviceRect = system == Qt::DeviceCoordinates ? sourceRect : info->painter->worldTransform().mapRect(sourceRect);
11857  effectRectF = item->graphicsEffect()->boundingRectFor(deviceRect);
11858  if (unpadded)
11859  *unpadded = (effectRectF.size() == sourceRect.size());
11860  if (info && system == Qt::LogicalCoordinates)
11861  effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
11862  } else {
11863  // no choice but to send a logical coordinate bounding rect to boundingRectFor
11864  effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
11865  }
11866  } else if (mode == QGraphicsEffect::PadToTransparentBorder) {
11867  // adjust by 1.5 to account for cosmetic pens
11868  effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
11869  } else {
11870  effectRectF = sourceRect;
11871  if (unpadded)
11872  *unpadded = true;
11873  }
11874 
11875  return effectRectF.toAlignedRect();
11876 }
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
QGraphicsEffect * graphicsEffect() const
Returns a pointer to this item&#39;s effect if it has one; otherwise 0.
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:781
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
virtual QRectF boundingRectFor(const QRectF &sourceRect) const
Returns the effective bounding rectangle for this effect, given the provided rect in the device coord...
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
QGraphicsItemPaintInfo * info

◆ pixmap()

QPixmap QGraphicsItemEffectSourcePrivate::pixmap ( Qt::CoordinateSystem  system,
QPoint offset,
QGraphicsEffect::PixmapPadMode  mode 
) const
virtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 11878 of file qgraphicsitem.cpp.

11880 {
11881  const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
11882  if (!info && deviceCoordinates) {
11883  // Device coordinates without info not yet supported.
11884  qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
11885  return QPixmap();
11886  }
11887  if (!item->d_ptr->scene)
11888  return QPixmap();
11889  QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
11890 
11891  bool unpadded;
11892  const QRectF sourceRect = boundingRect(system);
11893  QRect effectRect = paddedEffectRect(system, mode, sourceRect, &unpadded);
11894 
11895  if (offset)
11896  *offset = effectRect.topLeft();
11897 
11898  bool untransformed = !deviceCoordinates
11900  if (untransformed && unpadded && isPixmap()) {
11901  if (offset)
11902  *offset = boundingRect(system).topLeft().toPoint();
11903  return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
11904  }
11905 
11906  if (effectRect.isEmpty())
11907  return QPixmap();
11908 
11909  QPixmap pixmap(effectRect.size());
11911  QPainter pixmapPainter(&pixmap);
11912  pixmapPainter.setRenderHints(info ? info->painter->renderHints() : QPainter::TextAntialiasing);
11913 
11914  QTransform effectTransform = QTransform::fromTranslate(-effectRect.x(), -effectRect.y());
11915  if (deviceCoordinates && info->effectTransform)
11916  effectTransform *= *info->effectTransform;
11917 
11918  if (!info) {
11919  // Logical coordinates without info.
11920  QTransform sceneTransform = item->sceneTransform();
11921  QTransform newEffectTransform = sceneTransform.inverted();
11922  newEffectTransform *= effectTransform;
11923  scened->draw(item, &pixmapPainter, 0, &sceneTransform, 0, 0, qreal(1.0),
11924  &newEffectTransform, false, true);
11925  } else if (deviceCoordinates) {
11926  // Device coordinates with info.
11927  scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
11928  info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform,
11929  info->drawItem);
11930  } else {
11931  // Item coordinates with info.
11932  QTransform newEffectTransform = info->transformPtr->inverted();
11933  newEffectTransform *= effectTransform;
11934  scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
11935  info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform,
11936  info->drawItem);
11937  }
11938 
11939  pixmapPainter.end();
11940 
11941  return pixmap;
11942 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
const QTransform * transformPtr
double qreal
Definition: qglobal.h:1193
QScopedPointer< QGraphicsItemPrivate > d_ptr
QTransform sceneTransform() const
Returns this item&#39;s scene transformation matrix.
QGraphicsScene * scene
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
TransformationType type() const
Returns the transformation type of this matrix.
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
QRectF boundingRect(Qt::CoordinateSystem system) const
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
Q_CORE_EXPORT void qWarning(const char *,...)
const QTransform * viewTransform
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
const QTransform * effectTransform
const QTransform & worldTransform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9652
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
Definition: qpoint.h:376
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded=0) const
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QGraphicsItemPaintInfo * info
QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const
static QTransform fromTranslate(qreal dx, qreal dy)
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis...
Definition: qtransform.cpp:462
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
Definition: qpainter.cpp:7675
void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const, QRegion *, QWidget *, qreal, const QTransform *const, bool, bool)
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ styleOption()

const QStyleOption* QGraphicsItemEffectSourcePrivate::styleOption ( ) const
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 698 of file qgraphicsitem_p.h.

699  { return info ? info->option : 0; }
QStyleOptionGraphicsItem * option
QGraphicsItemPaintInfo * info

◆ update()

void QGraphicsItemEffectSourcePrivate::update ( )
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 681 of file qgraphicsitem_p.h.

681  {
683  item->update();
685  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.

◆ widget()

const QWidget* QGraphicsItemEffectSourcePrivate::widget ( ) const
inlinevirtual

Implements QGraphicsEffectSourcePrivate.

Definition at line 678 of file qgraphicsitem_p.h.

679  { return 0; }

Properties

◆ info

QGraphicsItemPaintInfo* QGraphicsItemEffectSourcePrivate::info

Definition at line 718 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive().

◆ item

QGraphicsItem* QGraphicsItemEffectSourcePrivate::item

Definition at line 717 of file qgraphicsitem_p.h.

◆ lastEffectTransform

QTransform QGraphicsItemEffectSourcePrivate::lastEffectTransform

Definition at line 719 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive().


The documentation for this class was generated from the following files: