Qt 4.8
Classes | Public Types | Public Functions | Static Public Functions | Public Variables | List of all members
QGraphicsItemPrivate Class Reference

#include <qgraphicsitem_p.h>

Inheritance diagram for QGraphicsItemPrivate:
QAbstractGraphicsShapeItemPrivate QDeclarativeItemPrivate QGraphicsItemGroupPrivate QGraphicsLineItemPrivate QGraphicsPixmapItemPrivate QGraphicsSvgItemPrivate QGraphicsWidgetPrivate QGraphicsEllipseItemPrivate QGraphicsPathItemPrivate QGraphicsPolygonItemPrivate QGraphicsRectItemPrivate QGraphicsSimpleTextItemPrivate QDeclarativeFlickablePrivate QDeclarativeFlipablePrivate QDeclarativeGestureAreaPrivate QDeclarativeImplicitSizeItemPrivate QDeclarativeMouseAreaPrivate QDeclarativePaintedItemPrivate QDeclarativeParticlesPrivate QDeclarativePathViewPrivate QDeclarativePinchAreaPrivate QDeclarativeRectanglePrivate QDeclarativeRepeaterPrivate QGraphicsProxyWidgetPrivate

Classes

struct  ExtraStruct
 
struct  TransformData
 

Public Types

enum  AncestorFlag {
  NoFlag = 0, AncestorHandlesChildEvents = 0x1, AncestorClipsChildren = 0x2, AncestorIgnoresTransformations = 0x4,
  AncestorFiltersChildEvents = 0x8
}
 
enum  Extra {
  ExtraToolTip, ExtraCursor, ExtraCacheData, ExtraMaxDeviceCoordCacheSize,
  ExtraBoundingRegionGranularity
}
 
enum  InvalidateReason { OpacityChanged }
 

Public Functions

void addChild (QGraphicsItem *child)
 QGraphicsScenePrivate::registerTopLevelItem(). More...
 
void appendGraphicsTransform (QGraphicsTransform *t)
 
qreal calcEffectiveOpacity () const
 
void childrenBoundingRectHelper (QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem)
 Returns the bounding rect of this item's children (excluding itself). More...
 
bool childrenClippedToShape () const
 
bool childrenCombineOpacity () const
 
QDeclarativeListProperty< QGraphicsObjectchildrenList ()
 Returns a list of this item's children. More...
 
void clearFocusHelper (bool giveFocusToParent)
 
void clearSubFocus (QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
 
qreal combineOpacityFromParent (qreal parentOpacity) const
 
void combineTransformFromParent (QTransform *x, const QTransform *viewTransform=0) const
 Combines this item's position and transform onto transform. More...
 
void combineTransformToParent (QTransform *x, const QTransform *viewTransform=0) const
 Combines this item's position and transform onto transform. More...
 
int depth () const
 
bool discardUpdateRequest (bool ignoreVisibleBit=false, bool ignoreDirtyBit=false, bool ignoreOpacity=false) const
 Returns true if we can discard an update request; otherwise false. More...
 
QRectF effectiveBoundingRect (QGraphicsItem *topMostEffectItem=0) const
 Returns the effective bounding rect of the item. More...
 
QRectF effectiveBoundingRect (const QRectF &rect) const
 Returns the effective bounding rect of the given item space rect. More...
 
qreal effectiveOpacity () const
 
void ensureSceneTransform ()
 
void ensureSceneTransformRecursive (QGraphicsItem **topMostDirtyItem)
 
void ensureSequentialSiblingIndex ()
 Ensures that the list of children is sorted by insertion order, and that the siblingIndexes are packed (no gaps), and start at 0. More...
 
void ensureSortedChildren ()
 
QVariant extra (Extra type) const
 
QGraphicsItemCacheextraItemCache () const
 
virtual void focusScopeItemChange (bool isSubFocusItem)
 Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is no longer a focusScopeItem). More...
 
QPointF genericMapFromScene (const QPointF &pos, const QWidget *viewport) const
 Maps the point pos from scene to item coordinates. More...
 
bool hasTranslateOnlySceneTransform ()
 
virtual qreal height () const
 
void initStyleOption (QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
 
virtual QVariant inputMethodQueryHelper (Qt::InputMethodQuery query) const
 This helper function helped us add input method query support in Qt 4. More...
 
void invalidateChildGraphicsEffectsRecursively (InvalidateReason reason)
 
void invalidateChildrenSceneTransform ()
 
void invalidateDepthRecursively ()
 
void invalidateParentGraphicsEffectsRecursively ()
 
bool isFullyTransparent () const
 
bool isInvisible () const
 
bool isOpacityNull () const
 
virtual bool isProxyWidget () const
 
bool itemIsUntransformable () const
 
void markParentDirty (bool updateBoundingRect=false)
 
QGraphicsItemCachemaybeExtraItemCache () const
 
void prependGraphicsTransform (QGraphicsTransform *t)
 
 QGraphicsItemPrivate ()
 
void remapItemPos (QEvent *event, QGraphicsItem *item)
 Maps any item pos properties of event to item's coordinate system. More...
 
void removeChild (QGraphicsItem *child)
 QGraphicsScenePrivate::unregisterTopLevelItem(). More...
 
void removeExtraItemCache ()
 
void resetFocusProxy ()
 Sets the focusProxy pointer to 0 for all items that have this item as their focusProxy. More...
 
virtual void resetHeight ()
 
virtual void resetWidth ()
 
void resolveDepth ()
 Resolves the stacking depth of this object and all its ancestors. More...
 
virtual void resolveFont (uint inheritedMask)
 
virtual void resolvePalette (uint inheritedMask)
 
QRectF sceneEffectiveBoundingRect () const
 Returns the effective bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect(), taking into account the effect that the item might have. More...
 
void sendScenePosChange ()
 
void setEnabledHelper (bool newEnabled, bool explicitly, bool update=true)
 Sets this item's visibility to newEnabled. More...
 
void setExtra (Extra type, const QVariant &value)
 
void setFocusHelper (Qt::FocusReason focusReason, bool climb, bool focusFromHide)
 
virtual void setHeight (qreal)
 
void setIsMemberOfGroup (bool enabled)
 Propagates item group membership. More...
 
void setParentItemHelper (QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant)
 Make sure not to trigger any pure virtual function calls (e. More...
 
virtual void setPosHelper (const QPointF &pos)
 Sets the position pos. More...
 
void setSubFocus (QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
 
void setTransformHelper (const QTransform &transform)
 Sets the transform transform. More...
 
void setVisibleHelper (bool newVisible, bool explicitly, bool update=true)
 Sets this item's visibility to newVisible. More...
 
virtual void setWidth (qreal)
 
virtual void siblingOrderChange ()
 Subclasses can reimplement this function to be notified when its siblingIndex order is changed. More...
 
virtual void subFocusItemChange ()
 Subclasses can reimplement this function to be notified when subFocusItem changes. More...
 
virtual void transformChanged ()
 
QTransform transformToParent () const
 
void unsetExtra (Extra type)
 
void updateAncestorFlag (QGraphicsItem::GraphicsItemFlag childFlag, AncestorFlag flag=NoFlag, bool enabled=false, bool root=true)
 Propagates the ancestor flag flag with value enabled to all this item's children. More...
 
void updateAncestorFlags ()
 
void updateChildWithGraphicsEffectFlagRecursively ()
 
void updatePaintedViewBoundingRects (bool updateChildren)
 
virtual void updateSceneTransformFromParent ()
 
virtual qreal width () const
 
virtual ~QGraphicsItemPrivate ()
 

Static Public Functions

static void children_append (QDeclarativeListProperty< QGraphicsObject > *list, QGraphicsObject *item)
 
static QGraphicsObjectchildren_at (QDeclarativeListProperty< QGraphicsObject > *list, int)
 
static void children_clear (QDeclarativeListProperty< QGraphicsObject > *list)
 
static int children_count (QDeclarativeListProperty< QGraphicsObject > *list)
 
static const QGraphicsItemPrivateget (const QGraphicsItem *item)
 
static QGraphicsItemPrivateget (QGraphicsItem *item)
 
static bool insertionOrder (QGraphicsItem *a, QGraphicsItem *b)
 
static bool isOpacityNull (qreal opacity)
 
static bool movableAncestorIsSelected (const QGraphicsItem *item)
 

Public Variables

quint32 acceptDrops: 1
 
quint32 acceptedMouseButtons: 5
 
quint32 acceptedTouchBeginEvent: 1
 
quint32 acceptsHover: 1
 
quint32 acceptTouchEvents: 1
 
quint32 allChildrenDirty: 1
 
quint32 ancestorFlags: 4
 
quint32 cacheMode: 2
 
QList< QGraphicsItem * > children
 
QRectF childrenBoundingRect
 
quint32 dirty: 1
 
quint32 dirtyChildren: 1
 
quint32 dirtyChildrenBoundingRect: 1
 
quint32 dirtySceneTransform: 1
 
quint32 enabled: 1
 
quint32 explicitActivate: 1
 
quint32 explicitlyDisabled: 1
 
quint32 explicitlyHidden: 1
 
QList< ExtraStructextras
 
quint32 filtersDescendantEvents: 1
 
quint32 flags: 19
 
QGraphicsItemfocusProxy
 
QList< QGraphicsItem ** > focusProxyRefs
 
QGraphicsItemfocusScopeItem
 
quint32 fullUpdatePending: 1
 
quint32 geometryChanged: 1
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
int globalStackingOrder
 
QGraphicsEffectgraphicsEffect
 
quint32 handlesChildEvents: 1
 
quint32 hasBoundingRegionGranularity: 1
 
quint32 hasCursor: 1
 
quint32 holesInSiblingIndex: 1
 
quint32 ignoreOpacity: 1
 
quint32 ignoreVisible: 1
 
Qt::InputMethodHints imHints
 
quint32 inDestructor: 1
 
int index
 
quint32 inSetPosHelper: 1
 
quint32 isDeclarativeItem: 1
 
quint32 isMemberOfGroup: 1
 
quint32 isObject: 1
 
quint32 isWidget: 1
 
int itemDepth
 
quint32 itemDiscovered: 1
 
quint32 localCollisionHack: 1
 
quint32 mayHaveChildWithGraphicsEffect: 1
 
quint32 mouseSetsFocus: 1
 
quint32 needSortChildren: 1
 
QRectF needsRepaint
 
quint32 notifyBoundingRectChanged: 1
 
quint32 notifyInvalidated: 1
 
qreal opacity
 
quint32 padding: 21
 
QMap< QWidget *, QRectpaintedViewBoundingRects
 
quint32 paintedViewBoundingRectsNeedRepaint: 1
 
QGraphicsItem::PanelModality panelModality
 
QGraphicsItemparent
 
quint32 pendingPolish: 1
 
QPointF pos
 
QGraphicsItemq_ptr
 
QGraphicsScenescene
 
quint32 scenePosDescendants: 1
 
QTransform sceneTransform
 
quint32 sceneTransformTranslateOnly: 1
 
quint32 selected: 1
 
quint32 sendParentChangeNotification: 1
 
quint32 sequentialOrdering: 1
 
int siblingIndex
 
QGraphicsItemsubFocusItem
 
TransformDatatransformData
 
quint32 updateDueToGraphicsEffect: 1
 
quint32 visible: 1
 
quint32 wantsActive: 1
 
qreal z
 

Detailed Description

Definition at line 158 of file qgraphicsitem_p.h.

Enumerations

◆ AncestorFlag

Enumerator
NoFlag 
AncestorHandlesChildEvents 
AncestorClipsChildren 
AncestorIgnoresTransformations 
AncestorFiltersChildEvents 

Definition at line 170 of file qgraphicsitem_p.h.

◆ Extra

◆ InvalidateReason

Enumerator
OpacityChanged 

Definition at line 291 of file qgraphicsitem_p.h.

Constructors and Destructors

◆ QGraphicsItemPrivate()

QGraphicsItemPrivate::QGraphicsItemPrivate ( )
inline

Definition at line 178 of file qgraphicsitem_p.h.

179  : z(0),
180  opacity(1.),
181  scene(0),
182  parent(0),
183  transformData(0),
184  graphicsEffect(0),
185  index(-1),
186  siblingIndex(-1),
187  itemDepth(-1),
188  focusProxy(0),
189  subFocusItem(0),
190  focusScopeItem(0),
193  acceptedMouseButtons(0x1f),
194  visible(1),
195  explicitlyHidden(0),
196  enabled(1),
198  selected(0),
199  acceptsHover(0),
200  acceptDrops(0),
201  isMemberOfGroup(0),
203  itemDiscovered(0),
204  hasCursor(0),
205  ancestorFlags(0),
206  cacheMode(0),
208  isWidget(0),
209  dirty(0),
210  dirtyChildren(0),
212  inSetPosHelper(0),
213  needSortChildren(0),
214  allChildrenDirty(0),
217  flags(0),
220  geometryChanged(1),
221  inDestructor(0),
222  isObject(0),
223  ignoreVisible(0),
224  ignoreOpacity(0),
231  mouseSetsFocus(1),
232  explicitActivate(0),
233  wantsActive(0),
238  pendingPolish(0),
243  q_ptr(0)
244  {
245  }
quint32 sendParentChangeNotification
QGraphicsItem * parent
QGraphicsItem * subFocusItem
QGraphicsItem::PanelModality panelModality
Qt::InputMethodHints imHints
QGraphicsItem * q_ptr
QGraphicsScene * scene
quint32 hasBoundingRegionGranularity
quint32 sceneTransformTranslateOnly
quint32 paintedViewBoundingRectsNeedRepaint
QGraphicsEffect * graphicsEffect
quint32 mayHaveChildWithGraphicsEffect
QGraphicsItem * focusScopeItem
TransformData * transformData
QGraphicsItem * focusProxy

◆ ~QGraphicsItemPrivate()

virtual QGraphicsItemPrivate::~QGraphicsItemPrivate ( )
inlinevirtual

Definition at line 247 of file qgraphicsitem_p.h.

248  { }

Functions

◆ addChild()

void QGraphicsItemPrivate::addChild ( QGraphicsItem child)

QGraphicsScenePrivate::registerTopLevelItem().

Warning
This function is not part of the public interface.

This function is almost identical to

Definition at line 5794 of file qgraphicsitem.cpp.

5795 {
5796  // Remove all holes from the sibling index list. Now the max index
5797  // number is equal to the size of the children list.
5799  needSortChildren = 1; // ### maybe 0
5800  child->d_ptr->siblingIndex = children.size();
5801  children.append(child);
5802  if (isObject)
5803  emit static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
5804 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define emit
Definition: qobjectdefs.h:76
void ensureSequentialSiblingIndex()
Ensures that the list of children is sorted by insertion order, and that the siblingIndexes are packe...
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children
The QGraphicsObject class provides a base class for all graphics items that require signals...

◆ appendGraphicsTransform()

void QGraphicsItemPrivate::appendGraphicsTransform ( QGraphicsTransform t)
Warning
This function is not part of the public interface.

Definition at line 4305 of file qgraphicsitem.cpp.

4306 {
4307  if (!transformData)
4311 
4312  Q_Q(QGraphicsItem);
4313  t->d_func()->setItem(q);
4314  transformData->onlyTransform = false;
4315  dirtySceneTransform = 1;
4316  transformChanged();
4317 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
#define Q_Q(Class)
Definition: qglobal.h:2483
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
QList< QGraphicsTransform * > graphicsTransforms
virtual void transformChanged()
TransformData * transformData

◆ calcEffectiveOpacity()

qreal QGraphicsItemPrivate::calcEffectiveOpacity ( ) const
inline

Definition at line 401 of file qgraphicsitem_p.h.

402  {
403  qreal o = opacity;
404  QGraphicsItem *p = parent;
405  int myFlags = flags;
406  while (p) {
407  int parentFlags = p->d_ptr->flags;
408 
409  // If I have a parent, and I don't ignore my parent's opacity, and my
410  // parent propagates to me, then combine my local opacity with my parent's
411  // effective opacity into my effective opacity.
414  break;
415  }
416 
417  o *= p->d_ptr->opacity;
418  p = p->d_ptr->parent;
419  myFlags = parentFlags;
420  }
421  return o;
422  }
QGraphicsItem * parent
double qreal
Definition: qglobal.h:1193
QScopedPointer< QGraphicsItemPrivate > d_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89

◆ children_append()

void QGraphicsItemPrivate::children_append ( QDeclarativeListProperty< QGraphicsObject > *  list,
QGraphicsObject item 
)
static

Definition at line 8163 of file qgraphicsitem.cpp.

8164 {
8165  if (item) {
8166  QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(list->object);
8168  item->setParentItem(graphicsObject);
8169  } else {
8170  QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
8171  }
8172  }
8173 }
quint32 sendParentChangeNotification
void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant)
Make sure not to trigger any pure virtual function calls (e.
void setParentItem(QGraphicsItem *parent)
Sets this item&#39;s parent item to newParent.
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
The QGraphicsObject class provides a base class for all graphics items that require signals...

◆ children_at()

QGraphicsObject * QGraphicsItemPrivate::children_at ( QDeclarativeListProperty< QGraphicsObject > *  list,
int  index 
)
static

Definition at line 8181 of file qgraphicsitem.cpp.

8182 {
8183  QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
8184  if (index >= 0 && index < d->children.count())
8185  return d->children.at(index)->toGraphicsObject();
8186  else
8187  return 0;
8188 }
double d
Definition: qnumeric_p.h:62
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
QList< QGraphicsItem * > children

◆ children_clear()

void QGraphicsItemPrivate::children_clear ( QDeclarativeListProperty< QGraphicsObject > *  list)
static

Definition at line 8190 of file qgraphicsitem.cpp.

8191 {
8192  QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
8193  int childCount = d->children.count();
8195  for (int index = 0; index < childCount; index++)
8196  d->children.at(0)->setParentItem(0);
8197  } else {
8198  for (int index = 0; index < childCount; index++)
8200  }
8201 }
double d
Definition: qnumeric_p.h:62
quint32 sendParentChangeNotification
void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant)
Make sure not to trigger any pure virtual function calls (e.
void setParentItem(QGraphicsItem *parent)
Sets this item&#39;s parent item to newParent.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
QList< QGraphicsItem * > children

◆ children_count()

int QGraphicsItemPrivate::children_count ( QDeclarativeListProperty< QGraphicsObject > *  list)
static

Definition at line 8175 of file qgraphicsitem.cpp.

8176 {
8177  QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
8178  return d->children.count();
8179 }
double d
Definition: qnumeric_p.h:62
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
QList< QGraphicsItem * > children

◆ childrenBoundingRectHelper()

void QGraphicsItemPrivate::childrenBoundingRectHelper ( QTransform x,
QRectF rect,
QGraphicsItem topMostEffectItem 
)

Returns the bounding rect of this item's children (excluding itself).

Warning
This function is not part of the public interface.

Definition at line 1341 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::childrenBoundingRect(), and childrenBoundingRectHelper().

1342 {
1343  Q_Q(QGraphicsItem);
1344 
1345  QRectF childrenRect;
1346  QRectF *result = rect;
1347  rect = &childrenRect;
1348  const bool setTopMostEffectItem = !topMostEffectItem;
1349 
1350  for (int i = 0; i < children.size(); ++i) {
1351  QGraphicsItem *child = children.at(i);
1352  QGraphicsItemPrivate *childd = child->d_ptr.data();
1353  if (setTopMostEffectItem)
1354  topMostEffectItem = child;
1355  bool hasPos = !childd->pos.isNull();
1356  if (hasPos || childd->transformData) {
1357  // COMBINE
1358  QTransform matrix = childd->transformToParent();
1359  if (x)
1360  matrix *= *x;
1361  *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
1362  if (!childd->children.isEmpty())
1363  childd->childrenBoundingRectHelper(&matrix, rect, topMostEffectItem);
1364  } else {
1365  if (x)
1366  *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect(topMostEffectItem));
1367  else
1368  *rect |= child->d_ptr->effectiveBoundingRect(topMostEffectItem);
1369  if (!childd->children.isEmpty())
1370  childd->childrenBoundingRectHelper(x, rect, topMostEffectItem);
1371  }
1372  }
1373 
1375  if (x)
1376  *rect &= x->mapRect(q->boundingRect());
1377  else
1378  *rect &= q->boundingRect();
1379  }
1380 
1381  *result |= *rect;
1382 }
QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem=0) const
Returns the effective bounding rect of the item.
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
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
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
void childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem)
Returns the bounding rect of this item&#39;s children (excluding itself).
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
Definition: qpoint.h:277
TransformData * transformData
QTransform transformToParent() const
QList< QGraphicsItem * > children
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ childrenClippedToShape()

bool QGraphicsItemPrivate::childrenClippedToShape ( ) const
inline

Definition at line 470 of file qgraphicsitem_p.h.

bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QList< QGraphicsItem * > children

◆ childrenCombineOpacity()

bool QGraphicsItemPrivate::childrenCombineOpacity ( ) const
inline

Definition at line 456 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsScenePrivate::processDirtyItemsRecursive(), and QGraphicsSceneIndexPrivate::recursive_items_helper().

457  {
458  if (!children.size())
459  return true;
461  return false;
462 
463  for (int i = 0; i < children.size(); ++i) {
465  return false;
466  }
467  return true;
468  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ childrenList()

QDeclarativeListProperty< QGraphicsObject > QGraphicsItemPrivate::childrenList ( )

Returns a list of this item's children.

The items are sorted by stacking order. This takes into account both the items' insertion order and their Z-values.

Definition at line 8210 of file qgraphicsitem.cpp.

Referenced by QDeclarativeFlickablePrivate::data_clear().

8211 {
8212  Q_Q(QGraphicsItem);
8213  if (isObject) {
8214  QGraphicsObject *that = static_cast<QGraphicsObject *>(q);
8217  } else {
8218  //QGraphicsItem is not supported for this property
8220  }
8221 }
static void children_clear(QDeclarativeListProperty< QGraphicsObject > *list)
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
#define Q_Q(Class)
Definition: qglobal.h:2483
static void children_append(QDeclarativeListProperty< QGraphicsObject > *list, QGraphicsObject *item)
static int children_count(QDeclarativeListProperty< QGraphicsObject > *list)
static QGraphicsObject * children_at(QDeclarativeListProperty< QGraphicsObject > *list, int)
QList< QGraphicsItem * > children
The QGraphicsObject class provides a base class for all graphics items that require signals...

◆ clearFocusHelper()

void QGraphicsItemPrivate::clearFocusHelper ( bool  giveFocusToParent)
Warning
This function is not part of the public interface.

Definition at line 3529 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::clearFocus().

3530 {
3533  while (subFocusItem->d_ptr->focusScopeItem)
3534  subFocusItem = subFocusItem->d_ptr->focusScopeItem;
3535  }
3536 
3537  if (giveFocusToParent) {
3538  // Pass focus to the closest parent focus scope
3539  if (!inDestructor) {
3540  QGraphicsItem *p = parent;
3541  while (p) {
3543  if (p->d_ptr->focusScopeItem == q_ptr) {
3544  p->d_ptr->focusScopeItem = 0;
3545  if (!subFocusItem->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere
3546  focusScopeItemChange(false);
3547  }
3548  if (subFocusItem->hasFocus())
3549  p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false,
3550  /* focusFromHide = */ false);
3551  return;
3552  }
3553  p = p->d_ptr->parent;
3554  }
3555  }
3556  }
3557 
3558  if (subFocusItem->hasFocus()) {
3559  // Invisible items with focus must explicitly clear subfocus.
3561 
3562  // If this item has the scene's input focus, clear it.
3563  scene->setFocusItem(0);
3564  }
3565 }
bool hasFocus() const
Returns true if this item is active, and it or its focus proxy has keyboard input focus; otherwise...
QGraphicsItem * parent
QGraphicsItem * subFocusItem
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide)
void setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason=Qt::OtherFocusReason)
Sets the scene&#39;s focus item to item, with the focus reason focusReason, after removing focus from any...
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
void clearSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
QGraphicsItem * focusScopeItem
virtual void focusScopeItemChange(bool isSubFocusItem)
Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is ...

◆ clearSubFocus()

void QGraphicsItemPrivate::clearSubFocus ( QGraphicsItem rootItem = 0,
QGraphicsItem stopItem = 0 
)
Warning
This function is not part of the public interface.

Definition at line 5951 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::removeItemHelper(), setFocusHelper(), and setSubFocus().

5952 {
5953  // Reset sub focus chain.
5954  QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
5955  do {
5956  if (parent->d_ptr->subFocusItem != q_ptr)
5957  break;
5958  parent->d_ptr->subFocusItem = 0;
5959  if (parent != stopItem && !parent->isAncestorOf(stopItem))
5960  parent->d_ptr->subFocusItemChange();
5961  } while (!parent->isPanel() && (parent = parent->d_ptr->parent));
5962 }
QGraphicsItem * parent
QGraphicsItem * subFocusItem
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child&#39;s parent, or one of child&#39;s parent&#39;s ancestors).
bool isPanel() const
Returns true if the item is a panel; otherwise returns false.
virtual void subFocusItemChange()
Subclasses can reimplement this function to be notified when subFocusItem changes.

◆ combineOpacityFromParent()

qreal QGraphicsItemPrivate::combineOpacityFromParent ( qreal  parentOpacity) const
inline

◆ combineTransformFromParent()

void QGraphicsItemPrivate::combineTransformFromParent ( QTransform x,
const QTransform viewTransform = 0 
) const

Combines this item's position and transform onto transform.

Warning
This function is not part of the public interface.

If you need to change this function (e.g., adding more transformation modes / options), make sure to change QGraphicsItem::deviceTransform() as well.

Definition at line 1073 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::deviceTransform(), and QGraphicsItem::itemTransform().

1074 {
1075  // COMBINE
1076  if (viewTransform && itemIsUntransformable()) {
1077  *x = q_ptr->deviceTransform(*viewTransform);
1078  } else {
1079  x->translate(pos.x(), pos.y());
1080  if (transformData)
1082  }
1083 }
QTransform computedFullTransform(QTransform *postmultiplyTransform=0) const
QGraphicsItem * q_ptr
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
bool itemIsUntransformable() const
QTransform deviceTransform(const QTransform &viewportTransform) const
Returns this item&#39;s device transformation matrix, using viewportTransform to map from scene to device...
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
TransformData * transformData

◆ combineTransformToParent()

void QGraphicsItemPrivate::combineTransformToParent ( QTransform x,
const QTransform viewTransform = 0 
) const

Combines this item's position and transform onto transform.

Warning
This function is not part of the public interface.

If you need to change this function (e.g., adding more transformation modes / options), make sure to change all places marked with COMBINE.

Definition at line 1048 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::itemTransform().

1049 {
1050  // COMBINE
1051  if (viewTransform && itemIsUntransformable()) {
1052  *x = q_ptr->deviceTransform(*viewTransform);
1053  } else {
1054  if (transformData)
1056  if (!pos.isNull())
1057  *x *= QTransform::fromTranslate(pos.x(), pos.y());
1058  }
1059 }
QTransform computedFullTransform(QTransform *postmultiplyTransform=0) const
QGraphicsItem * q_ptr
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
bool itemIsUntransformable() const
QTransform deviceTransform(const QTransform &viewportTransform) const
Returns this item&#39;s device transformation matrix, using viewportTransform to map from scene to device...
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
Definition: qpoint.h:277
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
TransformData * transformData
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

◆ depth()

int QGraphicsItemPrivate::depth ( ) const
Warning
This function is not part of the public interface.

Definition at line 5711 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::commonAncestorItem(), QGraphicsItem::isAncestorOf(), and qt_closestItemFirst().

5712 {
5713  if (itemDepth == -1)
5714  const_cast<QGraphicsItemPrivate *>(this)->resolveDepth();
5715 
5716  return itemDepth;
5717 }
void resolveDepth()
Resolves the stacking depth of this object and all its ancestors.

◆ discardUpdateRequest()

bool QGraphicsItemPrivate::discardUpdateRequest ( bool  ignoreVisibleBit = false,
bool  ignoreDirtyBit = false,
bool  ignoreOpacity = false 
) const

Returns true if we can discard an update request; otherwise false.

Warning
This function is not part of the public interface.

Definition at line 5697 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::markDirty().

5699 {
5700  // No scene, or if the scene is updating everything, means we have nothing
5701  // to do. The only exception is if the scene tracks the growing scene rect.
5702  return !scene
5703  || (!visible && !ignoreVisibleBit && !this->ignoreVisible)
5704  || (!ignoreDirtyBit && fullUpdatePending)
5706 }
QGraphicsScene * scene
bool isFullyTransparent() const
bool childrenCombineOpacity() const

◆ effectiveBoundingRect() [1/2]

QRectF QGraphicsItemPrivate::effectiveBoundingRect ( QGraphicsItem topMostEffectItem = 0) const

Returns the effective bounding rect of the item.

Warning
This function is not part of the public interface.
Since
4.6

If the item has no effect, this is the same as the item's bounding rect. If the item has an effect, the effective rect can be larger than the item's bouding rect, depending on the effect.

See also
boundingRect()

Definition at line 2994 of file qgraphicsitem.cpp.

Referenced by childrenBoundingRectHelper(), and effectiveBoundingRect().

2995 {
2996 #ifndef QT_NO_GRAPHICSEFFECT
2997  Q_Q(const QGraphicsItem);
2999  if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren || topMostEffectItem == q)
3000  return brect;
3001 
3002  const QGraphicsItem *effectParent = parent;
3003  while (effectParent) {
3004  QGraphicsEffect *effect = effectParent->d_ptr->graphicsEffect;
3005  if (scene && effect && effect->isEnabled()) {
3006  const QRectF brectInParentSpace = q->mapRectToItem(effectParent, brect);
3007  const QRectF effectRectInParentSpace = effectParent->d_ptr->effectiveBoundingRect(brectInParentSpace);
3008  brect = effectParent->mapRectToItem(q, effectRectInParentSpace);
3009  }
3011  || topMostEffectItem == effectParent) {
3012  return brect;
3013  }
3014  effectParent = effectParent->d_ptr->parent;
3015  }
3016 
3017  return brect;
3018 #else //QT_NO_GRAPHICSEFFECT
3019  return q_ptr->boundingRect();
3020 #endif //QT_NO_GRAPHICSEFFECT
3021 
3022 }
QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem=0) const
Returns the effective bounding rect of the item.
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
bool isEnabled() const
virtual QRectF boundingRect() const =0
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QGraphicsEffect * graphicsEffect
QRectF mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const
Maps the rectangle rect, which is in this item&#39;s coordinate system, to item&#39;s coordinate system...
The QGraphicsEffect class is the base class for all graphics effects.

◆ effectiveBoundingRect() [2/2]

QRectF QGraphicsItemPrivate::effectiveBoundingRect ( const QRectF rect) const

Returns the effective bounding rect of the given item space rect.

Warning
This function is not part of the public interface.
Since
4.6

If the item has no effect, the rect is returned unmodified. If the item has an effect, the effective rect can be extend beyond the item's bounding rect, depending on the effect.

See also
boundingRect()

Definition at line 2960 of file qgraphicsitem.cpp.

2961 {
2962 #ifndef QT_NO_GRAPHICSEFFECT
2963  Q_Q(const QGraphicsItem);
2964  QGraphicsEffect *effect = graphicsEffect;
2965  if (scene && effect && effect->isEnabled()) {
2966  if (scene->d_func()->views.isEmpty())
2967  return effect->boundingRectFor(rect);
2968  QRectF sceneRect = q->mapRectToScene(rect);
2969  QRectF sceneEffectRect;
2970  foreach (QGraphicsView *view, scene->views()) {
2971  QRectF deviceRect = view->d_func()->mapRectFromScene(sceneRect);
2972  QRect deviceEffectRect = effect->boundingRectFor(deviceRect).toAlignedRect();
2973  sceneEffectRect |= view->d_func()->mapRectToScene(deviceEffectRect);
2974  }
2975  return q->mapRectFromScene(sceneEffectRect);
2976  }
2977 #endif //QT_NO_GRAPHICSEFFECT
2978  return rect;
2979 }
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
bool isEnabled() const
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
QGraphicsEffect * graphicsEffect
virtual QRectF boundingRectFor(const QRectF &sourceRect) const
Returns the effective bounding rectangle for this effect, given the provided rect in the device coord...
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64
The QGraphicsEffect class is the base class for all graphics effects.

◆ effectiveOpacity()

qreal QGraphicsItemPrivate::effectiveOpacity ( ) const
inline

Definition at line 440 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::effectiveOpacity().

440  {
441  if (!parent || !opacity)
442  return opacity;
443 
444  return calcEffectiveOpacity();
445  }
QGraphicsItem * parent
qreal calcEffectiveOpacity() const

◆ ensureSceneTransform()

void QGraphicsItemPrivate::ensureSceneTransform ( )
inline

Definition at line 383 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::deviceTransform(), QGraphicsItem::itemTransform(), QGraphicsItem::sceneMatrix(), and QGraphicsItem::sceneTransform().

384  {
385  QGraphicsItem *that = q_func();
387  }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem)

◆ ensureSceneTransformRecursive()

void QGraphicsItemPrivate::ensureSceneTransformRecursive ( QGraphicsItem **  topMostDirtyItem)

Definition at line 5891 of file qgraphicsitem.cpp.

Referenced by ensureSceneTransformRecursive().

5892 {
5893  Q_ASSERT(topMostDirtyItem);
5894 
5895  if (dirtySceneTransform)
5896  *topMostDirtyItem = q_ptr;
5897 
5898  if (parent)
5899  parent->d_ptr->ensureSceneTransformRecursive(topMostDirtyItem);
5900 
5901  if (*topMostDirtyItem == q_ptr) {
5902  if (!dirtySceneTransform)
5903  return; // OK, neither my ancestors nor I have dirty scene transforms.
5904  *topMostDirtyItem = 0;
5905  } else if (*topMostDirtyItem) {
5906  return; // Continue backtrack.
5907  }
5908 
5909  // This item and all its descendants have dirty scene transforms.
5910  // We're about to validate this item's scene transform, so we have to
5911  // invalidate all the children; otherwise there's no way for the descendants
5912  // to detect that the ancestor has changed.
5914 
5915  // COMBINE my transform with the parent's scene transform.
5918 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
virtual void updateSceneTransformFromParent()
QGraphicsItem * q_ptr
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem)
void invalidateChildrenSceneTransform()

◆ ensureSequentialSiblingIndex()

void QGraphicsItemPrivate::ensureSequentialSiblingIndex ( )

Ensures that the list of children is sorted by insertion order, and that the siblingIndexes are packed (no gaps), and start at 0.

Warning
This function is not part of the public interface.

This function is almost identical to

QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes().

Definition at line 4956 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::registerTopLevelItem(), and QGraphicsItem::stackBefore().

4957 {
4958  if (!sequentialOrdering) {
4960  sequentialOrdering = 1;
4961  needSortChildren = 1;
4962  }
4963  if (holesInSiblingIndex) {
4964  holesInSiblingIndex = 0;
4965  for (int i = 0; i < children.size(); ++i)
4966  children[i]->d_ptr->siblingIndex = i;
4967  }
4968 }
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
static bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b)
void qSort(RandomAccessIterator start, RandomAccessIterator end)
Definition: qalgorithms.h:177
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ ensureSortedChildren()

void QGraphicsItemPrivate::ensureSortedChildren ( )
inline
Warning
This function is not part of the public interface.

Definition at line 824 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), QGraphicsItem::childItems(), QGraphicsScenePrivate::draw(), and QGraphicsSceneIndexPrivate::recursive_items_helper().

825 {
826  if (needSortChildren) {
827  needSortChildren = 0;
828  sequentialOrdering = 1;
829  if (children.isEmpty())
830  return;
832  for (int i = 0; i < children.size(); ++i) {
833  if (children.at(i)->d_ptr->siblingIndex != i) {
834  sequentialOrdering = 0;
835  break;
836  }
837  }
838  }
839 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void qSort(RandomAccessIterator start, RandomAccessIterator end)
Definition: qalgorithms.h:177
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ extra()

QVariant QGraphicsItemPrivate::extra ( Extra  type) const
inline

Definition at line 326 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::boundingRegionGranularity(), QGraphicsItem::cursor(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsProxyWidgetPrivate::embedSubWindow(), QGraphicsSvgItem::setMaximumCacheSize(), and QGraphicsItem::toolTip().

327  {
328  for (int i = 0; i < extras.size(); ++i) {
329  const ExtraStruct &extra = extras.at(i);
330  if (extra.type == type)
331  return extra.value;
332  }
333  return QVariant();
334  }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
int type
Definition: qmetatype.cpp:239
QList< ExtraStruct > extras
QVariant extra(Extra type) const

◆ extraItemCache()

QGraphicsItemCache * QGraphicsItemPrivate::extraItemCache ( ) const
Warning
This function is not part of the public interface.

Definition at line 5844 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::drawItemHelper(), QGraphicsItem::setCacheMode(), and QGraphicsItem::update().

5845 {
5846  QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
5847  if (!c) {
5848  QGraphicsItemPrivate *that = const_cast<QGraphicsItemPrivate *>(this);
5849  c = new QGraphicsItemCache;
5850  that->setExtra(ExtraCacheData, QVariant::fromValue<void *>(c));
5851  }
5852  return c;
5853 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QVariant extra(Extra type) const
void setExtra(Extra type, const QVariant &value)

◆ focusScopeItemChange()

void QGraphicsItemPrivate::focusScopeItemChange ( bool  isSubFocusItem)
virtual

Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is no longer a focusScopeItem).

Warning
This function is not part of the public interface.

Reimplemented in QDeclarativeItemPrivate.

Definition at line 6002 of file qgraphicsitem.cpp.

Referenced by setFocusHelper(), and setParentItemHelper().

6003 {
6004  Q_UNUSED(isSubFocusItem);
6005 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ genericMapFromScene()

QPointF QGraphicsItemPrivate::genericMapFromScene ( const QPointF pos,
const QWidget viewport 
) const

Maps the point pos from scene to item coordinates.

Warning
This function is not part of the public interface.

If view is passed and the item is untransformable, this function will correctly map pos from the scene using the view's transformation.

Definition at line 1022 of file qgraphicsitem.cpp.

Referenced by QGraphicsScene::contextMenuEvent(), QGraphicsScenePrivate::sendDragDropEvent(), QGraphicsScenePrivate::sendHoverEvent(), QGraphicsScenePrivate::sendMouseEvent(), QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(), QGraphicsScenePrivate::updateTouchPointsForItem(), and QGraphicsScene::wheelEvent().

1024 {
1025  Q_Q(const QGraphicsItem);
1026  if (!itemIsUntransformable())
1027  return q->mapFromScene(pos);
1028  QGraphicsView *view = 0;
1029  if (viewport)
1030  view = qobject_cast<QGraphicsView *>(viewport->parentWidget());
1031  if (!view)
1032  return q->mapFromScene(pos);
1033  // ### More ping pong than needed.
1034  return q->deviceTransform(view->viewportTransform()).inverted().map(view->mapFromScene(pos));
1035 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
#define Q_Q(Class)
Definition: qglobal.h:2483
QTransform viewportTransform() const
Returns a matrix that maps viewport coordinates to scene coordinates.
bool itemIsUntransformable() const
QPoint mapFromScene(const QPointF &point) const
Returns the scene coordinate point to viewport coordinates.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64

◆ get() [1/2]

static const QGraphicsItemPrivate* QGraphicsItemPrivate::get ( const QGraphicsItem item)
inlinestatic

Definition at line 250 of file qgraphicsitem_p.h.

Referenced by QDeclarativeAnchorsPrivate::addDepend(), adjustedItemEffectiveBoundingRect(), adjustedPosition(), children_append(), children_at(), children_at_helper(), children_clear(), children_clear_helper(), children_count(), children_count_helper(), QDeclarativeLoaderPrivate::clear(), QDeclarativeListViewPrivate::createHighlight(), QDeclarativeListViewPrivate::createItem(), QDeclarativeItemPrivate::data_append(), QDeclarativeFlickablePrivate::data_append(), QDeclarativeFlickablePrivate::data_clear(), QDeclarativeColumn::doPositioning(), QDeclarativeRow::doPositioning(), QDeclarativeGrid::doPositioning(), QDeclarativeFlow::doPositioning(), QDeclarativeAnchorsPrivate::fillChanged(), QDeclarativeItemPrivate::focusChanged(), QDeclarativePathViewPrivate::getItem(), hcenter(), QDeclarativeFlickablePrivate::init(), QDeclarativeLoaderPrivate::initResize(), QDeclarativeViewPrivate::initResize(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QDeclarativeAnchors::mirrored(), position(), QDeclarativeBasePositioner::prePositioning(), QDeclarativeItemKeyFilter::QDeclarativeItemKeyFilter(), QDeclarativePathViewPrivate::releaseItem(), QDeclarativeListViewPrivate::releaseItem(), QDeclarativeAnchorsPrivate::remDepend(), QDeclarativeColumn::reportConflictingAnchors(), QDeclarativeRow::reportConflictingAnchors(), QDeclarativeGrid::reportConflictingAnchors(), QDeclarativeFlow::reportConflictingAnchors(), QDeclarativeFlipablePrivate::setBackTransform(), QDeclarativeAnchorsPrivate::setItemHeight(), QDeclarativeAnchorsPrivate::setItemSize(), QDeclarativeAnchorsPrivate::setItemWidth(), QDeclarativeView::setResizeMode(), QDeclarativeItemPrivate::transform_append(), QDeclarativeItemPrivate::transform_at(), QDeclarativeItemPrivate::transform_clear(), QDeclarativeItemPrivate::transform_count(), QDeclarativeBasePositionerPrivate::unwatchChanges(), QDeclarativeGridViewPrivate::updateFooter(), QDeclarativeListViewPrivate::updateFooter(), QDeclarativeGridViewPrivate::updateHeader(), QDeclarativeListViewPrivate::updateHeader(), QDeclarativeAnchorsPrivate::updateHorizontalAnchors(), QDeclarativeAnchorsPrivate::updateVerticalAnchors(), QDeclarativeFlickableVisibleArea::updateVisible(), vcenter(), QDeclarativeBasePositionerPrivate::watchChanges(), and QDeclarativeLoader::~QDeclarativeLoader().

251  {
252  return item->d_ptr.data();
253  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.

◆ get() [2/2]

static QGraphicsItemPrivate* QGraphicsItemPrivate::get ( QGraphicsItem item)
inlinestatic

Definition at line 254 of file qgraphicsitem_p.h.

255  {
256  return item->d_ptr.data();
257  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.

◆ hasTranslateOnlySceneTransform()

bool QGraphicsItemPrivate::hasTranslateOnlySceneTransform ( )
inline

◆ height()

qreal QGraphicsItemPrivate::height ( ) const
virtual

◆ initStyleOption()

void QGraphicsItemPrivate::initStyleOption ( QStyleOptionGraphicsItem option,
const QTransform worldTransform,
const QRegion exposedRegion,
bool  allItems = false 
) const

Definition at line 1384 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::draw(), and QGraphicsView::paintEvent().

1386 {
1387  Q_ASSERT(option);
1388  Q_Q(const QGraphicsItem);
1389 
1390  // Initialize standard QStyleOption values.
1391  const QRectF brect = q->boundingRect();
1392  option->state = QStyle::State_None;
1393  option->rect = brect.toRect();
1394  option->levelOfDetail = 1;
1395  option->exposedRect = brect;
1396  if (selected)
1397  option->state |= QStyle::State_Selected;
1398  if (enabled)
1399  option->state |= QStyle::State_Enabled;
1400  if (q->hasFocus())
1401  option->state |= QStyle::State_HasFocus;
1402  if (scene) {
1403  if (scene->d_func()->hoverItems.contains(q_ptr))
1404  option->state |= QStyle::State_MouseOver;
1405  if (q == scene->mouseGrabberItem())
1406  option->state |= QStyle::State_Sunken;
1407  }
1408 
1410  return;
1411 
1412  // Initialize QStyleOptionGraphicsItem specific values (matrix, exposedRect).
1413  option->matrix = worldTransform.toAffine(); //### discards perspective
1414 
1415  if (!allItems) {
1416  // Determine the item's exposed area
1417  option->exposedRect = QRectF();
1418  const QTransform reverseMap = worldTransform.inverted();
1419  const QVector<QRect> exposedRects(exposedRegion.rects());
1420  for (int i = 0; i < exposedRects.size(); ++i) {
1421  option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i)));
1422  if (option->exposedRect.contains(brect))
1423  break;
1424  }
1425  option->exposedRect &= brect;
1426  }
1427 }
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
qreal levelOfDetail
Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() together with QPainter::worldTransform() i...
Definition: qstyleoption.h:875
QGraphicsItem * mouseGrabberItem() const
Returns the current mouse grabber item, or 0 if no item is currently grabbing the mouse...
#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
#define Q_Q(Class)
Definition: qglobal.h:2483
bool contains(const QPointF &p) const
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false...
Definition: qrect.cpp:2349
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
const QMatrix & toAffine() const
Returns the QTransform as an affine matrix.
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
QMatrix matrix
the complete transformation matrix for the item
Definition: qstyleoption.h:874
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
if(void) toggleToolbarShown
QRectF exposedRect
the exposed rectangle, in item coordinates
Definition: qstyleoption.h:873
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ inputMethodQueryHelper()

QVariant QGraphicsItemPrivate::inputMethodQueryHelper ( Qt::InputMethodQuery  query) const
virtual

This helper function helped us add input method query support in Qt 4.

Warning
This function is not part of the public interface.

4.1 without having to reimplement the inputMethodQuery() function in QGraphicsProxyWidget. ### Qt 5: Remove. We cannot remove it in 4.5+ even if we do reimplement the function properly, because apps compiled with 4.4 will not be able to call the reimplementation.

Reimplemented in QGraphicsProxyWidgetPrivate.

Definition at line 1134 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::inputMethodQuery().

1135 {
1136  Q_UNUSED(query);
1137  return QVariant();
1138 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ insertionOrder()

bool QGraphicsItemPrivate::insertionOrder ( QGraphicsItem a,
QGraphicsItem b 
)
inlinestatic
Warning
This function is not part of the public interface.

Definition at line 844 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::ensureSequentialTopLevelSiblingIndexes().

845 {
846  return a->d_ptr->siblingIndex < b->d_ptr->siblingIndex;
847 }
QScopedPointer< QGraphicsItemPrivate > d_ptr

◆ invalidateChildGraphicsEffectsRecursively()

void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively ( QGraphicsItemPrivate::InvalidateReason  reason)

Definition at line 5734 of file qgraphicsitem.cpp.

Referenced by invalidateChildGraphicsEffectsRecursively(), and QGraphicsItem::setOpacity().

5735 {
5737  return;
5738 
5739  for (int i = 0; i < children.size(); ++i) {
5740  QGraphicsItemPrivate *childPrivate = children.at(i)->d_ptr.data();
5741  if (reason == OpacityChanged && (childPrivate->flags & QGraphicsItem::ItemIgnoresParentOpacity))
5742  continue;
5743  if (childPrivate->graphicsEffect) {
5744  childPrivate->notifyInvalidated = 1;
5745  static_cast<QGraphicsItemEffectSourcePrivate *>(childPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
5746  }
5747 
5748  childPrivate->invalidateChildGraphicsEffectsRecursively(reason);
5749  }
5750 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QGraphicsEffect * graphicsEffect
quint32 mayHaveChildWithGraphicsEffect
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...
void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason)

◆ invalidateChildrenSceneTransform()

void QGraphicsItemPrivate::invalidateChildrenSceneTransform ( )
inline

Definition at line 395 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsScenePrivate::processDirtyItemsRecursive(), and QGraphicsSceneIndexPrivate::recursive_items_helper().

396  {
397  for (int i = 0; i < children.size(); ++i)
399  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ invalidateDepthRecursively()

void QGraphicsItemPrivate::invalidateDepthRecursively ( )
Warning
This function is not part of the public interface.

Definition at line 5756 of file qgraphicsitem.cpp.

Referenced by invalidateDepthRecursively().

5757 {
5758  if (itemDepth == -1)
5759  return;
5760 
5761  itemDepth = -1;
5762  for (int i = 0; i < children.size(); ++i)
5764 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ invalidateParentGraphicsEffectsRecursively()

void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively ( )
Warning
This function is not part of the public interface.

Definition at line 5723 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setOpacity(), and QGraphicsItem::update().

5724 {
5725  QGraphicsItemPrivate *itemPrivate = this;
5726  do {
5727  if (itemPrivate->graphicsEffect && !itemPrivate->updateDueToGraphicsEffect) {
5728  itemPrivate->notifyInvalidated = 1;
5729  static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
5730  }
5731  } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
5732 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
QGraphicsEffect * graphicsEffect
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...

◆ isFullyTransparent()

bool QGraphicsItemPrivate::isFullyTransparent ( ) const
inline

Definition at line 430 of file qgraphicsitem_p.h.

431  {
432  if (isOpacityNull())
433  return true;
434  if (!parent)
435  return false;
436 
438  }
QGraphicsItem * parent
bool isOpacityNull() const
qreal calcEffectiveOpacity() const

◆ isInvisible()

bool QGraphicsItemPrivate::isInvisible ( ) const
inline

Definition at line 473 of file qgraphicsitem_p.h.

474  {
476  }
bool isFullyTransparent() const
bool childrenCombineOpacity() const

◆ isOpacityNull() [1/2]

bool QGraphicsItemPrivate::isOpacityNull ( ) const
inline

◆ isOpacityNull() [2/2]

static bool QGraphicsItemPrivate::isOpacityNull ( qreal  opacity)
inlinestatic

Definition at line 427 of file qgraphicsitem_p.h.

428  { return (opacity < qreal(0.001)); }
double qreal
Definition: qglobal.h:1193

◆ isProxyWidget()

bool QGraphicsItemPrivate::isProxyWidget ( ) const
virtual
Warning
This function is not part of the public interface.

Tells us if it is a proxy widget

Reimplemented in QGraphicsProxyWidgetPrivate.

Definition at line 6025 of file qgraphicsitem.cpp.

Referenced by QGraphicsProxyWidgetPrivate::setWidget_helper().

6026 {
6027  return false;
6028 }

◆ itemIsUntransformable()

bool QGraphicsItemPrivate::itemIsUntransformable ( ) const
inline

◆ markParentDirty()

void QGraphicsItemPrivate::markParentDirty ( bool  updateBoundingRect = false)
inline
Warning
This function is not part of the public interface.

Definition at line 852 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::markDirty(), QGraphicsItem::prepareGeometryChange(), and QGraphicsItem::setFlags().

853 {
854  QGraphicsItemPrivate *parentp = this;
855 #ifndef QT_NO_GRAPHICSEFFECT
856  if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) {
857  parentp->notifyInvalidated = 1;
858  static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
859  ->source->d_func())->invalidateCache();
860  }
861 #endif
862  while (parentp->parent) {
863  parentp = parentp->parent->d_ptr.data();
864  parentp->dirtyChildren = 1;
865 
866  if (updateBoundingRect) {
867  parentp->dirtyChildrenBoundingRect = 1;
868  // ### Only do this if the parent's effect applies to the entire subtree.
869  parentp->notifyBoundingRectChanged = 1;
870  }
871 #ifndef QT_NO_GRAPHICSEFFECT
872  if (parentp->graphicsEffect) {
873  if (updateBoundingRect) {
874  static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
875  ->source->d_func())->invalidateCache();
876  parentp->notifyInvalidated = 1;
877  }
878  if (parentp->scene && parentp->graphicsEffect->isEnabled()) {
879  parentp->dirty = 1;
880  parentp->fullUpdatePending = 1;
881  }
882  }
883 #endif
884  }
885 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
bool isEnabled() const
QGraphicsScene * scene
QGraphicsEffect * graphicsEffect
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...

◆ maybeExtraItemCache()

QGraphicsItemCache * QGraphicsItemPrivate::maybeExtraItemCache ( ) const
Warning
This function is not part of the public interface.

Definition at line 5836 of file qgraphicsitem.cpp.

5837 {
5839 }
QVariant extra(Extra type) const
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571

◆ movableAncestorIsSelected()

bool QGraphicsItemPrivate::movableAncestorIsSelected ( const QGraphicsItem item)
static

Definition at line 7529 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::mouseMoveEvent().

7530 {
7531  const QGraphicsItem *parent = item->d_ptr->parent;
7532  return parent && (((parent->flags() & QGraphicsItem::ItemIsMovable) && parent->isSelected()) || _qt_movableAncestorIsSelected(parent));
7533 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
bool isSelected() const
Returns true if this item is selected; otherwise, false is returned.
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
bool _qt_movableAncestorIsSelected(const QGraphicsItem *item)
obsolete

◆ prependGraphicsTransform()

void QGraphicsItemPrivate::prependGraphicsTransform ( QGraphicsTransform t)
Warning
This function is not part of the public interface.

Definition at line 4288 of file qgraphicsitem.cpp.

Referenced by QDeclarativeItemPrivate::transform_append().

4289 {
4290  if (!transformData)
4294 
4295  Q_Q(QGraphicsItem);
4296  t->d_func()->setItem(q);
4297  transformData->onlyTransform = false;
4298  dirtySceneTransform = 1;
4299  transformChanged();
4300 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
#define Q_Q(Class)
Definition: qglobal.h:2483
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
void prepend(const T &t)
Inserts value at the beginning of the list.
Definition: qlist.h:541
QList< QGraphicsTransform * > graphicsTransforms
virtual void transformChanged()
TransformData * transformData

◆ remapItemPos()

void QGraphicsItemPrivate::remapItemPos ( QEvent event,
QGraphicsItem item 
)

Maps any item pos properties of event to item's coordinate system.

Warning
This function is not part of the public interface.

Definition at line 973 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::sceneEvent().

974 {
976  switch (event->type()) {
982  mouseEvent->setPos(item->mapFromItem(q, mouseEvent->pos()));
983  mouseEvent->setLastPos(item->mapFromItem(q, mouseEvent->pos()));
984  for (int i = 0x1; i <= 0x10; i <<= 1) {
985  if (mouseEvent->buttons() & i) {
986  Qt::MouseButton button = Qt::MouseButton(i);
987  mouseEvent->setButtonDownPos(button, item->mapFromItem(q, mouseEvent->buttonDownPos(button)));
988  }
989  }
990  break;
991  }
993  QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event);
994  wheelEvent->setPos(item->mapFromItem(q, wheelEvent->pos()));
995  break;
996  }
999  contextEvent->setPos(item->mapFromItem(q, contextEvent->pos()));
1000  break;
1001  }
1003  QGraphicsSceneHoverEvent *hoverEvent = static_cast<QGraphicsSceneHoverEvent *>(event);
1004  hoverEvent->setPos(item->mapFromItem(q, hoverEvent->pos()));
1005  break;
1006  }
1007  default:
1008  break;
1009  }
1010 }
EventRef event
void setLastPos(const QPointF &pos)
QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const
Maps the point point, which is in item&#39;s coordinate system, to this item&#39;s coordinate system...
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
void setButtonDownPos(Qt::MouseButton button, const QPointF &pos)
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointF pos() const
Returns the position of the cursor in item coordinates when the wheel event occurred.
void setPos(const QPointF &pos)
Sets the position associated with the context menu to the given point in item coordinates.
void setPos(const QPointF &pos)
void setPos(const QPointF &pos)
QPointF pos() const
Returns the position of the mouse cursor in item coordinates at the moment the context menu was reque...
QPointF pos() const
Returns the position of the mouse cursor in item coordinates at the moment the hover event was sent...
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
void setPos(const QPointF &pos)
Sets the position associated with the hover event to the given point in item coordinates.
QPointF pos() const
Returns the mouse cursor position in item coordinates.
QPointF buttonDownPos(Qt::MouseButton button) const
Returns the mouse cursor position in item coordinates where the specified button was clicked...
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent...
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
MouseButton
Definition: qnamespace.h:150
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework...

◆ removeChild()

void QGraphicsItemPrivate::removeChild ( QGraphicsItem child)

QGraphicsScenePrivate::unregisterTopLevelItem().

Warning
This function is not part of the public interface.

This function is almost identical to

Definition at line 5815 of file qgraphicsitem.cpp.

5816 {
5817  // When removing elements in the middle of the children list,
5818  // there will be a "gap" in the list of sibling indexes (0,1,3,4).
5819  if (!holesInSiblingIndex)
5820  holesInSiblingIndex = child->d_ptr->siblingIndex != children.size() - 1;
5823  else
5824  children.removeOne(child);
5825  // NB! Do not use children.removeAt(child->d_ptr->siblingIndex) because
5826  // the child is not guaranteed to be at the index after the list is sorted.
5827  // (see ensureSortedChildren()).
5828  child->d_ptr->siblingIndex = -1;
5829  if (isObject)
5830  emit static_cast<QGraphicsObject *>(q_ptr)->childrenChanged();
5831 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
bool removeOne(const T &t)
Removes the first occurrence of value in the list and returns true on success; otherwise returns fals...
Definition: qlist.h:796
#define emit
Definition: qobjectdefs.h:76
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children
The QGraphicsObject class provides a base class for all graphics items that require signals...
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ removeExtraItemCache()

void QGraphicsItemPrivate::removeExtraItemCache ( )
Warning
This function is not part of the public interface.

Definition at line 5858 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setCacheMode(), and QGraphicsItem::~QGraphicsItem().

5859 {
5860  QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
5861  if (c) {
5862  c->purge();
5863  delete c;
5864  }
5866 }
void unsetExtra(Extra type)
unsigned char c[8]
Definition: qnumeric_p.h:62
void purge()
Empty all cached pixmaps from the pixmap cache.
QVariant extra(Extra type) const

◆ resetFocusProxy()

void QGraphicsItemPrivate::resetFocusProxy ( )

Sets the focusProxy pointer to 0 for all items that have this item as their focusProxy.

Warning
This function is not part of the public interface.

Qt 5: Use QPointer instead.

Definition at line 5973 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::removeItemHelper(), and QGraphicsItem::~QGraphicsItem().

5974 {
5975  for (int i = 0; i < focusProxyRefs.size(); ++i)
5976  *focusProxyRefs.at(i) = 0;
5978 }
QList< QGraphicsItem ** > focusProxyRefs
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void clear()
Removes all items from the list.
Definition: qlist.h:764
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ resetHeight()

void QGraphicsItemPrivate::resetHeight ( )
virtual
Warning
This function is not part of the public interface. Reset the height of the item Reimplemented by QGraphicsWidget

Reimplemented in QDeclarativeItemPrivate, and QGraphicsWidgetPrivate.

Definition at line 8277 of file qgraphicsitem.cpp.

8278 {
8279 }

◆ resetWidth()

void QGraphicsItemPrivate::resetWidth ( )
virtual
Warning
This function is not part of the public interface. Reset the width of the item Reimplemented by QGraphicsWidget

Reimplemented in QDeclarativeItemPrivate, and QGraphicsWidgetPrivate.

Definition at line 8248 of file qgraphicsitem.cpp.

8249 {
8250 }

◆ resolveDepth()

void QGraphicsItemPrivate::resolveDepth ( )

Resolves the stacking depth of this object and all its ancestors.

Warning
This function is not part of the public interface.

Definition at line 5774 of file qgraphicsitem.cpp.

5775 {
5776  if (!parent)
5777  itemDepth = 0;
5778  else {
5779  if (parent->d_ptr->itemDepth == -1)
5781  itemDepth = parent->d_ptr->itemDepth + 1;
5782  }
5783 }
QGraphicsItem * parent
void resolveDepth()
Resolves the stacking depth of this object and all its ancestors.
QScopedPointer< QGraphicsItemPrivate > d_ptr

◆ resolveFont()

virtual void QGraphicsItemPrivate::resolveFont ( uint  inheritedMask)
inlinevirtual

Reimplemented in QGraphicsWidgetPrivate.

Definition at line 312 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), QGraphicsWidgetPrivate::updateFont(), and QGraphicsScenePrivate::updateFont().

313  {
314  for (int i = 0; i < children.size(); ++i)
315  children.at(i)->d_ptr->resolveFont(inheritedMask);
316  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
virtual void resolveFont(uint inheritedMask)
QList< QGraphicsItem * > children

◆ resolvePalette()

virtual void QGraphicsItemPrivate::resolvePalette ( uint  inheritedMask)
inlinevirtual

Reimplemented in QGraphicsWidgetPrivate.

Definition at line 318 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), QGraphicsWidgetPrivate::updatePalette(), and QGraphicsScenePrivate::updatePalette().

319  {
320  for (int i = 0; i < children.size(); ++i)
321  children.at(i)->d_ptr->resolveFont(inheritedMask);
322  }
QScopedPointer< QGraphicsItemPrivate > d_ptr
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
virtual void resolveFont(uint inheritedMask)
QList< QGraphicsItem * > children

◆ sceneEffectiveBoundingRect()

QRectF QGraphicsItemPrivate::sceneEffectiveBoundingRect ( ) const

Returns the effective bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect(), taking into account the effect that the item might have.

Warning
This function is not part of the public interface.
Since
4.6

If the item has no effect, this is the same as sceneBoundingRect().

See also
effectiveBoundingRect(), sceneBoundingRect()

Definition at line 3038 of file qgraphicsitem.cpp.

Referenced by QGraphicsSceneBspTreeIndexPrivate::removeItem().

3039 {
3040  // Find translate-only offset
3041  // COMBINE
3042  QPointF offset;
3043  const QGraphicsItem *parentItem = q_ptr;
3044  const QGraphicsItemPrivate *itemd;
3045  do {
3046  itemd = parentItem->d_ptr.data();
3047  if (itemd->transformData)
3048  break;
3049  offset += itemd->pos;
3050  } while ((parentItem = itemd->parent));
3051 
3053  br.translate(offset);
3054  return !parentItem ? br : parentItem->sceneTransform().mapRect(br);
3055 }
QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem=0) const
Returns the effective bounding rect of the item.
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
QTransform sceneTransform() const
Returns this item&#39;s scene transformation matrix.
QGraphicsItem * q_ptr
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
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
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
Definition: qrect.h:716
TransformData * transformData

◆ sendScenePosChange()

void QGraphicsItemPrivate::sendScenePosChange ( )
inline
Warning
This function is not part of the public interface.

Definition at line 4973 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setPos(), and QGraphicsItem::setTransform().

4974 {
4975  Q_Q(QGraphicsItem);
4976  if (scene) {
4978  q->itemChange(QGraphicsItem::ItemScenePositionHasChanged, q->scenePos());
4979  if (scenePosDescendants) {
4980  foreach (QGraphicsItem *item, scene->d_func()->scenePosItems) {
4981  if (q->isAncestorOf(item))
4983  }
4984  }
4985  }
4986 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
This virtual function is called by QGraphicsItem to notify custom items that some part of the item&#39;s ...
QGraphicsScene * scene
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointF scenePos() const
Returns the item&#39;s position in scene coordinates.

◆ setEnabledHelper()

void QGraphicsItemPrivate::setEnabledHelper ( bool  newEnabled,
bool  explicitly,
bool  update = true 
)

Sets this item's visibility to newEnabled.

Warning
This function is not part of the public interface.

If explicitly is true, this item will be "explicitly" newEnabled; otherwise, it.. will not be.

Definition at line 2618 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setEnabled(), and setEnabledHelper().

2619 {
2620  // Update explicit bit.
2621  if (explicitly)
2622  explicitlyDisabled = newEnabled ? 0 : 1;
2623 
2624  // Check if there's nothing to do.
2625  if (enabled == quint32(newEnabled))
2626  return;
2627 
2628  // Certain properties are dropped when an item is disabled.
2629  if (!newEnabled) {
2630  if (scene && scene->mouseGrabberItem() == q_ptr)
2631  q_ptr->ungrabMouse();
2632  if (q_ptr->hasFocus()) {
2633  // Disabling the closest non-panel ancestor of the focus item
2634  // causes focus to pop to the next item, otherwise it's cleared.
2635  QGraphicsItem *focusItem = scene->focusItem();
2636  if (isWidget && !focusItem->isPanel() && q_ptr->isAncestorOf(focusItem)) {
2637  do {
2638  if (focusItem == q_ptr) {
2639  static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true);
2640  break;
2641  }
2642  } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
2643  }
2644  // Clear focus if previous steps didn't move it to another widget
2645  if (q_ptr->hasFocus())
2646  q_ptr->clearFocus();
2647  }
2648  if (q_ptr->isSelected())
2649  q_ptr->setSelected(false);
2650  }
2651 
2652  // Modify the property.
2653  const QVariant newEnabledVariant(q_ptr->itemChange(QGraphicsItem::ItemEnabledChange,
2654  quint32(newEnabled)));
2655  enabled = newEnabledVariant.toBool();
2656 
2657  // Schedule redraw.
2658  if (update)
2659  q_ptr->update();
2660 
2661  foreach (QGraphicsItem *child, children) {
2662  if (!newEnabled || !child->d_ptr->explicitlyDisabled)
2663  child->d_ptr->setEnabledHelper(newEnabled, /* explicitly = */ false);
2664  }
2665 
2666  // Deliver post-change notification.
2668 
2669  if (isObject)
2670  emit static_cast<QGraphicsObject *>(q_ptr)->enabledChanged();
2671 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool hasFocus() const
Returns true if this item is active, and it or its focus proxy has keyboard input focus; otherwise...
QGraphicsWidget * parentWidget() const
Returns a pointer to the item&#39;s parent widget.
QScopedPointer< QGraphicsItemPrivate > d_ptr
void setSelected(bool selected)
If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
void clearFocus()
Takes keyboard input focus from the item.
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
This virtual function is called by QGraphicsItem to notify custom items that some part of the item&#39;s ...
QGraphicsScene * scene
void setEnabledHelper(bool newEnabled, bool explicitly, bool update=true)
Sets this item&#39;s visibility to newEnabled.
QGraphicsItem * mouseGrabberItem() const
Returns the current mouse grabber item, or 0 if no item is currently grabbing the mouse...
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.
bool isSelected() const
Returns true if this item is selected; otherwise, false is returned.
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene&#39;s current focus item, or 0 if no item curr...
#define emit
Definition: qobjectdefs.h:76
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child&#39;s parent, or one of child&#39;s parent&#39;s ancestors).
bool isPanel() const
Returns true if the item is a panel; otherwise returns false.
unsigned int quint32
Definition: qglobal.h:938
void ungrabMouse()
Releases the mouse grab.
QList< QGraphicsItem * > children
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.

◆ setExtra()

void QGraphicsItemPrivate::setExtra ( Extra  type,
const QVariant value 
)
inline

Definition at line 336 of file qgraphicsitem_p.h.

Referenced by extraItemCache(), QGraphicsItem::setBoundingRegionGranularity(), QGraphicsItem::setCursor(), QGraphicsSvgItem::setMaximumCacheSize(), and QGraphicsItem::setToolTip().

337  {
338  int index = -1;
339  for (int i = 0; i < extras.size(); ++i) {
340  if (extras.at(i).type == type) {
341  index = i;
342  break;
343  }
344  }
345 
346  if (index == -1) {
347  extras << ExtraStruct(type, value);
348  } else {
349  extras[index].value = value;
350  }
351  }
int type
Definition: qmetatype.cpp:239
QList< ExtraStruct > extras

◆ setFocusHelper()

void QGraphicsItemPrivate::setFocusHelper ( Qt::FocusReason  focusReason,
bool  climb,
bool  focusFromHide 
)
Warning
This function is not part of the public interface.

Definition at line 3450 of file qgraphicsitem.cpp.

Referenced by clearFocusHelper(), QGraphicsItem::setFocus(), and setVisibleHelper().

3451 {
3452  // Disabled / unfocusable items cannot accept focus.
3454  return;
3455 
3456  // Find focus proxy.
3457  QGraphicsItem *f = q_ptr;
3458  while (f->d_ptr->focusProxy)
3459  f = f->d_ptr->focusProxy;
3460 
3461  // Return if it already has focus.
3462  if (scene && scene->focusItem() == f)
3463  return;
3464 
3465  // Update focus scope item ptr.
3466  QGraphicsItem *p = parent;
3467  while (p) {
3469  QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem;
3470  p->d_ptr->focusScopeItem = q_ptr;
3471  if (oldFocusScopeItem)
3472  oldFocusScopeItem->d_ptr->focusScopeItemChange(false);
3473  focusScopeItemChange(true);
3474  if (!p->focusItem() && !focusFromHide) {
3475  // Calling setFocus() on a child of a focus scope that does
3476  // not have focus changes only the focus scope pointer,
3477  // so that focus is restored the next time the scope gains
3478  // focus.
3479  return;
3480  }
3481  break;
3482  }
3483  p = p->d_ptr->parent;
3484  }
3485 
3486  if (climb) {
3487  while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible())
3488  f = f->d_ptr->focusScopeItem;
3489  }
3490 
3491  // Update the child focus chain.
3492  QGraphicsItem *commonAncestor = 0;
3493  if (scene && scene->focusItem()) {
3494  commonAncestor = scene->focusItem()->commonAncestorItem(f);
3495  scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor);
3496  }
3497 
3498  f->d_ptr->setSubFocus(f, commonAncestor);
3499 
3500  // Update the scene's focus item.
3501  if (scene) {
3502  QGraphicsItem *p = q_ptr->panel();
3503  if ((!p && scene->isActive()) || (p && p->isActive())) {
3504  // Visible items immediately gain focus from scene.
3505  scene->d_func()->setFocusItemHelper(f, focusReason);
3506  }
3507  }
3508 }
QGraphicsItem * parent
QGraphicsItem * focusItem() const
If this item, a child or descendant of this item currently has input focus, this function will return...
QGraphicsItem * commonAncestorItem(const QGraphicsItem *other) const
Returns the closest common ancestor item of this item and other, or 0 if either other is 0...
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
QGraphicsScene * scene
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene&#39;s current focus item, or 0 if no item curr...
QGraphicsItem * panel() const
Returns the item&#39;s panel, or 0 if this item does not have a panel.
bool isActive() const
Returns true if this item is active; otherwise returns false.
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
void clearSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
bool isActive() const
Returns true if the scene is active (e.
QGraphicsItem * focusScopeItem
void setSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
QGraphicsItem * focusProxy
virtual void focusScopeItemChange(bool isSubFocusItem)
Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is ...

◆ setHeight()

void QGraphicsItemPrivate::setHeight ( qreal  h)
virtual
Warning
This function is not part of the public interface. Set the height of the item Reimplemented by QGraphicsWidget

Reimplemented in QDeclarativeItemPrivate, and QGraphicsWidgetPrivate.

Definition at line 8267 of file qgraphicsitem.cpp.

Referenced by QDeclarativeAnchorsPrivate::setItemHeight().

8268 {
8269  Q_UNUSED(h);
8270 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setIsMemberOfGroup()

void QGraphicsItemPrivate::setIsMemberOfGroup ( bool  enabled)

Propagates item group membership.

Warning
This function is not part of the public interface.

Definition at line 955 of file qgraphicsitem.cpp.

956 {
959  if (!qgraphicsitem_cast<QGraphicsItemGroup *>(q)) {
960  foreach (QGraphicsItem *child, children)
961  child->d_func()->setIsMemberOfGroup(enabled);
962  }
963 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
#define Q_Q(Class)
Definition: qglobal.h:2483
QList< QGraphicsItem * > children

◆ setParentItemHelper()

void QGraphicsItemPrivate::setParentItemHelper ( QGraphicsItem newParent,
const QVariant newParentVariant,
const QVariant thisPointerVariant 
)

Make sure not to trigger any pure virtual function calls (e.

Warning
This function is not part of the public interface.

g., prepareGeometryChange) if the item is in its destructor, i.e. inDestructor is 1.

Definition at line 1150 of file qgraphicsitem.cpp.

Referenced by children_append(), QDeclarativeItemPrivate::data_append(), QDeclarativeFlickablePrivate::data_append(), QGraphicsWidgetPrivate::init(), and QGraphicsItem::setParentItem().

1152 {
1153  Q_Q(QGraphicsItem);
1154  if (newParent == parent)
1155  return;
1156 
1157  if (isWidget)
1158  static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent &&
1159  newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0,
1160  scene);
1161  if (scene) {
1162  // Deliver the change to the index
1163  if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex)
1164  scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParent);
1165 
1166  // Disable scene pos notifications for old ancestors
1168  scene->d_func()->setScenePosItemEnabled(q, false);
1169  }
1170 
1171  if (subFocusItem && parent) {
1172  // Make sure none of the old parents point to this guy.
1174  }
1175 
1176  // We anticipate geometry changes. If the item is deleted, it will be
1177  // removed from the index at a later stage, and the whole scene will be
1178  // updated.
1179  if (!inDestructor)
1181 
1182  if (parent) {
1183  // Remove from current parent
1184  parent->d_ptr->removeChild(q);
1185  if (thisPointerVariant)
1187  }
1188 
1189  // Update toplevelitem list. If this item is being deleted, its parent
1190  // will be 0 but we don't want to register/unregister it in the TLI list.
1191  if (scene && !inDestructor) {
1192  if (parent && !newParent) {
1193  scene->d_func()->registerTopLevelItem(q);
1194  } else if (!parent && newParent) {
1195  scene->d_func()->unregisterTopLevelItem(q);
1196  }
1197  }
1198 
1199  // Ensure any last parent focus scope does not point to this item or any of
1200  // its descendents.
1201  QGraphicsItem *p = parent;
1202  QGraphicsItem *parentFocusScopeItem = 0;
1203  while (p) {
1205  // If this item's focus scope's focus scope item points
1206  // to this item or a descendent, then clear it.
1207  QGraphicsItem *fsi = p->d_ptr->focusScopeItem;
1208  if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
1209  parentFocusScopeItem = fsi;
1210  p->d_ptr->focusScopeItem = 0;
1211  }
1212  break;
1213  }
1214  p = p->d_ptr->parent;
1215  }
1216 
1217  // Update graphics effect optimization flag
1218  if (newParent && (graphicsEffect || mayHaveChildWithGraphicsEffect))
1220 
1221  // Update focus scope item ptr in new scope.
1222  QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
1223  if (newFocusScopeItem && newParent) {
1224  QGraphicsItem *p = newParent;
1225  while (p) {
1227  if (subFocusItem && subFocusItem != q_ptr) {
1228  // Find the subFocusItem's topmost focus scope within the new parent's focusscope
1229  QGraphicsItem *ancestorScope = 0;
1231  while (p2 && p2 != p) {
1233  ancestorScope = p2;
1235  break;
1236  if (p2 == q_ptr)
1237  break;
1238  p2 = p2->d_ptr->parent;
1239  }
1240  if (ancestorScope)
1241  newFocusScopeItem = ancestorScope;
1242  }
1243 
1244  p->d_ptr->focusScopeItem = newFocusScopeItem;
1245  newFocusScopeItem->d_ptr->focusScopeItemChange(true);
1246  // Ensure the new item is no longer the subFocusItem. The
1247  // only way to set focus on a child of a focus scope is
1248  // by setting focus on the scope itself.
1249  if (subFocusItem && !p->focusItem())
1251  break;
1252  }
1253  p = p->d_ptr->parent;
1254  }
1255  }
1256 
1257  // Resolve depth.
1259 
1260  if ((parent = newParent)) {
1261  if (parent->d_func()->scene && parent->d_func()->scene != scene) {
1262  // Move this item to its new parent's scene
1263  parent->d_func()->scene->addItem(q);
1264  } else if (!parent->d_func()->scene && scene) {
1265  // Remove this item from its former scene
1266  scene->removeItem(q);
1267  }
1268 
1269  parent->d_ptr->addChild(q);
1270  if (thisPointerVariant)
1271  parent->itemChange(QGraphicsItem::ItemChildAddedChange, *thisPointerVariant);
1272  if (scene) {
1273  // Re-enable scene pos notifications for new ancestors
1274  if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges))
1275  scene->d_func()->setScenePosItemEnabled(q, true);
1276  }
1277 
1278  // Propagate dirty flags to the new parent
1279  markParentDirty(/*updateBoundingRect=*/true);
1280 
1281  // Inherit ancestor flags from the new parent.
1283 
1284  // Update item visible / enabled.
1285  if (parent->d_ptr->visible != visible) {
1286  if (!parent->d_ptr->visible || !explicitlyHidden)
1287  setVisibleHelper(parent->d_ptr->visible, /* explicit = */ false, /* update = */ false);
1288  }
1289  if (parent->isEnabled() != enabled) {
1291  setEnabledHelper(parent->d_ptr->enabled, /* explicit = */ false, /* update = */ false);
1292  }
1293 
1294  // Auto-activate if visible and the parent is active.
1295  if (visible && parent->isActive())
1296  q->setActive(true);
1297  } else {
1298  // Inherit ancestor flags from the new parent.
1300 
1301  if (!inDestructor) {
1302  // Update item visible / enabled.
1303  if (!visible && !explicitlyHidden)
1304  setVisibleHelper(true, /* explicit = */ false);
1305  if (!enabled && !explicitlyDisabled)
1306  setEnabledHelper(true, /* explicit = */ false);
1307  }
1308  }
1309 
1310  dirtySceneTransform = 1;
1311  if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
1312  transformChanged();
1313 
1314  // Reparenting is finished, now safe to notify the previous focusScopeItem about changes
1315  if (parentFocusScopeItem)
1316  parentFocusScopeItem->d_ptr->focusScopeItemChange(false);
1317 
1318  // Restore the sub focus chain.
1319  if (subFocusItem) {
1320  subFocusItem->d_ptr->setSubFocus(newParent);
1321  if (parent && parent->isActive())
1323  }
1324 
1325  // Deliver post-change notification
1326  if (newParentVariant)
1327  q->itemChange(QGraphicsItem::ItemParentHasChanged, *newParentVariant);
1328 
1329  if (isObject)
1330  emit static_cast<QGraphicsObject *>(q)->parentChanged();
1331 }
QGraphicsItem * parent
QGraphicsItem * subFocusItem
QGraphicsItem * focusItem() const
If this item, a child or descendant of this item currently has input focus, this function will return...
QScopedPointer< QGraphicsItemPrivate > d_ptr
void removeChild(QGraphicsItem *child)
QGraphicsScenePrivate::unregisterTopLevelItem().
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
This virtual function is called by QGraphicsItem to notify custom items that some part of the item&#39;s ...
QGraphicsScene * scene
void setEnabledHelper(bool newEnabled, bool explicitly, bool update=true)
Sets this item&#39;s visibility to newEnabled.
void addItem(QGraphicsItem *item)
Adds or moves the item and all its childen to this scene.
void addChild(QGraphicsItem *child)
QGraphicsScenePrivate::registerTopLevelItem().
bool isEnabled() const
Returns true if the item is enabled; otherwise, false is returned.
#define Q_Q(Class)
Definition: qglobal.h:2483
void removeItem(QGraphicsItem *item)
Removes the item item and all its children from the scene.
#define emit
Definition: qobjectdefs.h:76
QGraphicsEffect * graphicsEffect
bool isActive() const
Returns true if this item is active; otherwise returns false.
quint32 mayHaveChildWithGraphicsEffect
void clearSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child&#39;s parent, or one of child&#39;s parent&#39;s ancestors).
void prepareGeometryChange()
Prepares the item for a geometry change.
void setVisibleHelper(bool newVisible, bool explicitly, bool update=true)
Sets this item&#39;s visibility to newVisible.
virtual void transformChanged()
QGraphicsItem * focusScopeItem
void setSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
bool isWidget() const
Returns true if this item is a widget (i.
TransformData * transformData
QGraphicsScene * scene() const
Returns the current scene for the item, or 0 if the item is not stored in a scene.
The QGraphicsObject class provides a base class for all graphics items that require signals...
void markParentDirty(bool updateBoundingRect=false)
virtual void focusScopeItemChange(bool isSubFocusItem)
Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is ...
void updateChildWithGraphicsEffectFlagRecursively()
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Gives keyboard input focus to this item.

◆ setPosHelper()

void QGraphicsItemPrivate::setPosHelper ( const QPointF pos)
virtual

Sets the position pos.

Warning
This function is not part of the public interface.

Reimplemented in QDeclarativeItemPrivate.

Definition at line 3903 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setPos(), and QDeclarativeItemPrivate::setPosHelper().

3904 {
3905  Q_Q(QGraphicsItem);
3906  inSetPosHelper = 1;
3907  if (scene)
3908  q->prepareGeometryChange();
3909  QPointF oldPos = this->pos;
3910  this->pos = pos;
3911  dirtySceneTransform = 1;
3912  inSetPosHelper = 0;
3913  if (isObject) {
3914  if (pos.x() != oldPos.x())
3915  emit static_cast<QGraphicsObject *>(q_ptr)->xChanged();
3916  if (pos.y() != oldPos.y())
3917  emit static_cast<QGraphicsObject *>(q_ptr)->yChanged();
3918  }
3919 }
QGraphicsItem * q_ptr
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ setSubFocus()

void QGraphicsItemPrivate::setSubFocus ( QGraphicsItem rootItem = 0,
QGraphicsItem stopItem = 0 
)
Warning
This function is not part of the public interface.

Definition at line 5923 of file qgraphicsitem.cpp.

Referenced by setFocusHelper().

5924 {
5925  // Update focus child chain. Stop at panels, or if this item
5926  // is hidden, stop at the first item with a visible parent.
5927  QGraphicsItem *parent = rootItem ? rootItem : q_ptr;
5928  if (parent->panel() != q_ptr->panel())
5929  return;
5930 
5931  do {
5932  // Clear any existing ancestor's subFocusItem.
5933  if (parent != q_ptr && parent->d_ptr->subFocusItem) {
5934  if (parent->d_ptr->subFocusItem == q_ptr)
5935  break;
5936  parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem);
5937  }
5938  parent->d_ptr->subFocusItem = q_ptr;
5939  parent->d_ptr->subFocusItemChange();
5940  } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible));
5941 
5942  if (scene && !scene->isActive()) {
5943  scene->d_func()->passiveFocusItem = subFocusItem;
5944  scene->d_func()->lastFocusItem = subFocusItem;
5945  }
5946 }
QGraphicsItem * parent
QGraphicsItem * subFocusItem
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsScene * scene
QGraphicsItem * panel() const
Returns the item&#39;s panel, or 0 if this item does not have a panel.
void clearSubFocus(QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
bool isActive() const
Returns true if the scene is active (e.
bool isPanel() const
Returns true if the item is a panel; otherwise returns false.
virtual void subFocusItemChange()
Subclasses can reimplement this function to be notified when subFocusItem changes.

◆ setTransformHelper()

void QGraphicsItemPrivate::setTransformHelper ( const QTransform transform)

Sets the transform transform.

Warning
This function is not part of the public interface.

Definition at line 3929 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setMatrix(), and QGraphicsItem::setTransform().

3930 {
3932  transformData->transform = transform;
3933  dirtySceneTransform = 1;
3934  transformChanged();
3935 }
QGraphicsItem * q_ptr
void prepareGeometryChange()
Prepares the item for a geometry change.
virtual void transformChanged()
TransformData * transformData

◆ setVisibleHelper()

void QGraphicsItemPrivate::setVisibleHelper ( bool  newVisible,
bool  explicitly,
bool  update = true 
)

Sets this item's visibility to newVisible.

Warning
This function is not part of the public interface.

If explicitly is true, this item will be "explicitly" newVisible; otherwise, it.. will not be.

Definition at line 2387 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setVisible(), and setVisibleHelper().

2388 {
2389  Q_Q(QGraphicsItem);
2390 
2391  // Update explicit bit.
2392  if (explicitly)
2393  explicitlyHidden = newVisible ? 0 : 1;
2394 
2395  // Check if there's nothing to do.
2396  if (visible == quint32(newVisible))
2397  return;
2398 
2399  // Don't show child if parent is not visible
2400  if (parent && newVisible && !parent->d_ptr->visible)
2401  return;
2402 
2403  // Modify the property.
2404  const QVariant newVisibleVariant(q_ptr->itemChange(QGraphicsItem::ItemVisibleChange,
2405  quint32(newVisible)));
2406  newVisible = newVisibleVariant.toBool();
2407  if (visible == quint32(newVisible))
2408  return;
2409  visible = newVisible;
2410 
2411  // Schedule redrawing
2412  if (update) {
2413  QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
2414  if (c)
2415  c->purge();
2416  if (scene) {
2417 #ifndef QT_NO_GRAPHICSEFFECT
2419 #endif //QT_NO_GRAPHICSEFFECT
2420  scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true);
2421  }
2422  }
2423 
2424  // Certain properties are dropped as an item becomes invisible.
2425  bool hasFocus = q_ptr->hasFocus();
2426  if (!newVisible) {
2427  if (scene) {
2428  if (scene->d_func()->mouseGrabberItems.contains(q))
2429  q->ungrabMouse();
2430  if (scene->d_func()->keyboardGrabberItems.contains(q))
2431  q->ungrabKeyboard();
2432  if (q->isPanel() && panelModality != QGraphicsItem::NonModal)
2433  scene->d_func()->leaveModal(q_ptr);
2434  }
2435  if (hasFocus && scene) {
2436  // Hiding the closest non-panel ancestor of the focus item
2437  QGraphicsItem *focusItem = scene->focusItem();
2438  if (isWidget && !focusItem->isPanel()) {
2439  do {
2440  if (focusItem == q_ptr) {
2441  static_cast<QGraphicsWidget *>(q_ptr)->focusNextPrevChild(true);
2442  break;
2443  }
2444  } while ((focusItem = focusItem->parentWidget()) && !focusItem->isPanel());
2445  }
2446  // Clear focus if previous steps didn't move it to another widget
2447  if (q_ptr->hasFocus())
2448  clearFocusHelper(/* giveFocusToParent = */ false);
2449  }
2450  if (q_ptr->isSelected())
2451  q_ptr->setSelected(false);
2452  } else {
2453  geometryChanged = 1;
2455  if (scene) {
2456  if (isWidget) {
2457  QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
2458  if (widget->windowType() == Qt::Popup)
2459  scene->d_func()->addPopup(widget);
2460  }
2461  if (q->isPanel() && panelModality != QGraphicsItem::NonModal) {
2462  scene->d_func()->enterModal(q_ptr);
2463  }
2464  }
2465  }
2466 
2467  // Update children with explicitly = false.
2468  const bool updateChildren = update && !((flags & QGraphicsItem::ItemClipsChildrenToShape)
2470  foreach (QGraphicsItem *child, children) {
2471  if (!newVisible || !child->d_ptr->explicitlyHidden)
2472  child->d_ptr->setVisibleHelper(newVisible, false, updateChildren);
2473  }
2474 
2475  // Update activation
2476  if (scene && q->isPanel()) {
2477  if (newVisible) {
2478  if (parent && parent->isActive())
2479  q->setActive(true);
2480  } else {
2481  if (q->isActive())
2483  }
2484  }
2485 
2486  // Enable subfocus
2487  if (scene) {
2488  if (newVisible) {
2489  // Item is shown
2490  QGraphicsItem *p = parent;
2491  bool done = false;
2492  while (p) {
2494  QGraphicsItem *fsi = p->d_ptr->focusScopeItem;
2495  if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
2496  done = true;
2497  while (fsi->d_ptr->focusScopeItem && fsi->d_ptr->focusScopeItem->isVisible())
2498  fsi = fsi->d_ptr->focusScopeItem;
2499  fsi->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true,
2500  /* focusFromHide = */ false);
2501  }
2502  break;
2503  }
2504  p = p->d_ptr->parent;
2505  }
2506  if (!done) {
2508  if (fi && fi != scene->focusItem()) {
2509  scene->setFocusItem(fi);
2510  } else if (flags & QGraphicsItem::ItemIsFocusScope &&
2511  !scene->focusItem() &&
2512  q->isAncestorOf(scene->d_func()->lastFocusItem)) {
2513  q_ptr->setFocus();
2514  }
2515  }
2516  } else {
2517  // Item is hidden
2518  if (hasFocus) {
2519  QGraphicsItem *p = parent;
2520  while (p) {
2522  if (p->d_ptr->visible) {
2523  p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true,
2524  /* focusFromHide = */ true);
2525  }
2526  break;
2527  }
2528  p = p->d_ptr->parent;
2529  }
2530  }
2531  }
2532  }
2533 
2534  // Deliver post-change notification.
2536 
2537  if (isObject)
2538  emit static_cast<QGraphicsObject *>(q_ptr)->visibleChanged();
2539 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
bool hasFocus() const
Returns true if this item is active, and it or its focus proxy has keyboard input focus; otherwise...
QGraphicsItem * parent
QGraphicsItem * subFocusItem
void invalidateParentGraphicsEffectsRecursively()
unsigned char c[8]
Definition: qnumeric_p.h:62
QGraphicsWidget * parentWidget() const
Returns a pointer to the item&#39;s parent widget.
QGraphicsItem::PanelModality panelModality
QPointer< QWidget > widget
QScopedPointer< QGraphicsItemPrivate > d_ptr
void setSelected(bool selected)
If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
QGraphicsItem * q_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
This virtual function is called by QGraphicsItem to notify custom items that some part of the item&#39;s ...
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
QGraphicsScene * scene
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
Definition: qvariant.cpp:2691
bool isSelected() const
Returns true if this item is selected; otherwise, false is returned.
Qt::WindowType windowType() const
Returns the widgets window type.
#define Q_Q(Class)
Definition: qglobal.h:2483
void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QGraphicsItem * focusItem() const
When the scene is active, this functions returns the scene&#39;s current focus item, or 0 if no item curr...
void purge()
Empty all cached pixmaps from the pixmap cache.
quint32 paintedViewBoundingRectsNeedRepaint
#define emit
Definition: qobjectdefs.h:76
void setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason=Qt::OtherFocusReason)
Sets the scene&#39;s focus item to item, with the focus reason focusReason, after removing focus from any...
bool isActive() const
Returns true if this item is active; otherwise returns false.
void clearFocusHelper(bool giveFocusToParent)
GraphicsItemFlags flags() const
Returns this item&#39;s flags.
QVariant extra(Extra type) const
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child&#39;s parent, or one of child&#39;s parent&#39;s ancestors).
void setActivePanel(QGraphicsItem *item)
Activates item, which must be an item in this scene.
void setVisibleHelper(bool newVisible, bool explicitly, bool update=true)
Sets this item&#39;s visibility to newVisible.
bool isPanel() const
Returns true if the item is a panel; otherwise returns false.
QGraphicsItem * focusScopeItem
unsigned int quint32
Definition: qglobal.h:938
QList< QGraphicsItem * > children
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.
void setFocus(Qt::FocusReason focusReason=Qt::OtherFocusReason)
Gives keyboard input focus to this item.

◆ setWidth()

void QGraphicsItemPrivate::setWidth ( qreal  w)
virtual
Warning
This function is not part of the public interface. Set the width of the item Reimplemented by QGraphicsWidget

Reimplemented in QDeclarativeItemPrivate, and QGraphicsWidgetPrivate.

Definition at line 8238 of file qgraphicsitem.cpp.

Referenced by QDeclarativeAnchorsPrivate::setItemWidth().

8239 {
8240  Q_UNUSED(w);
8241 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ siblingOrderChange()

void QGraphicsItemPrivate::siblingOrderChange ( )
virtual

Subclasses can reimplement this function to be notified when its siblingIndex order is changed.

Warning
This function is not part of the public interface.

Reimplemented in QDeclarativeItemPrivate.

Definition at line 6016 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::stackBefore().

6017 {
6018 }

◆ subFocusItemChange()

void QGraphicsItemPrivate::subFocusItemChange ( )
virtual

Subclasses can reimplement this function to be notified when subFocusItem changes.

Warning
This function is not part of the public interface.

Definition at line 5989 of file qgraphicsitem.cpp.

Referenced by clearSubFocus(), and setSubFocus().

5990 {
5991 }

◆ transformChanged()

virtual void QGraphicsItemPrivate::transformChanged ( )
inlinevirtual

◆ transformToParent()

QTransform QGraphicsItemPrivate::transformToParent ( ) const
inline

Definition at line 814 of file qgraphicsitem_p.h.

Referenced by childrenBoundingRectHelper(), QGraphicsItem::mapFromParent(), QGraphicsItem::mapRectFromParent(), QGraphicsItem::mapRectToParent(), and QGraphicsItem::mapToParent().

815 {
816  QTransform matrix;
817  combineTransformToParent(&matrix);
818  return matrix;
819 }
void combineTransformToParent(QTransform *x, const QTransform *viewTransform=0) const
Combines this item&#39;s position and transform onto transform.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ unsetExtra()

void QGraphicsItemPrivate::unsetExtra ( Extra  type)
inline

Definition at line 353 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::setBoundingRegionGranularity(), and QGraphicsItem::unsetCursor().

354  {
355  for (int i = 0; i < extras.size(); ++i) {
356  if (extras.at(i).type == type) {
357  extras.removeAt(i);
358  return;
359  }
360  }
361  }
int type
Definition: qmetatype.cpp:239
QList< ExtraStruct > extras

◆ updateAncestorFlag()

void QGraphicsItemPrivate::updateAncestorFlag ( QGraphicsItem::GraphicsItemFlag  childFlag,
AncestorFlag  flag = NoFlag,
bool  enabled = false,
bool  root = true 
)

Propagates the ancestor flag flag with value enabled to all this item's children.

Warning
This function is not part of the public interface.

If root is false, the flag is also set on this item (default is true).

Definition at line 853 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setFiltersChildEvents(), QGraphicsItem::setFlags(), and QGraphicsItem::setHandlesChildEvents().

855 {
857  if (root) {
858  // For root items only. This is the item that has either enabled or
859  // disabled \a childFlag, or has been reparented.
860  switch (int(childFlag)) {
861  case -2:
863  enabled = q->filtersChildEvents();
864  break;
865  case -1:
867  enabled = q->handlesChildEvents();
868  break;
870  flag = AncestorClipsChildren;
872  break;
876  break;
877  default:
878  return;
879  }
880 
881  if (parent) {
882  // Inherit the enabled-state from our parents.
883  if ((parent->d_ptr->ancestorFlags & flag)
884  || (int(parent->d_ptr->flags & childFlag) == childFlag)
885  || (childFlag == -1 && parent->d_ptr->handlesChildEvents)
886  || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)) {
887  enabled = true;
888  ancestorFlags |= flag;
889  } else {
890  ancestorFlags &= ~flag;
891  }
892  } else {
893  // Top-level root items don't have any ancestors, so there are no
894  // ancestor flags either.
895  ancestorFlags = 0;
896  }
897  } else {
898  // Don't set or propagate the ancestor flag if it's already correct.
899  if (((ancestorFlags & flag) && enabled) || (!(ancestorFlags & flag) && !enabled))
900  return;
901 
902  // Set the flag.
903  if (enabled)
904  ancestorFlags |= flag;
905  else
906  ancestorFlags &= ~flag;
907 
908  // Don't process children if the item has the main flag set on itself.
909  if ((childFlag != -1 && int(flags & childFlag) == childFlag)
910  || (int(childFlag) == -1 && handlesChildEvents)
911  || (int(childFlag) == -2 && filtersDescendantEvents))
912  return;
913  }
914 
915  for (int i = 0; i < children.size(); ++i)
916  children.at(i)->d_ptr->updateAncestorFlag(childFlag, flag, enabled, false);
917 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
void updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag, AncestorFlag flag=NoFlag, bool enabled=false, bool root=true)
Propagates the ancestor flag flag with value enabled to all this item&#39;s children. ...
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ updateAncestorFlags()

void QGraphicsItemPrivate::updateAncestorFlags ( )

Definition at line 919 of file qgraphicsitem.cpp.

920 {
921  int flags = 0;
922  if (parent) {
923  // Inherit the parent's ancestor flags.
925  flags = pd->ancestorFlags;
926 
927  // Add in flags from the parent.
928  if (pd->filtersDescendantEvents)
930  if (pd->handlesChildEvents)
933  flags |= AncestorClipsChildren;
936  }
937 
938  if (ancestorFlags == flags)
939  return; // No change; stop propagation.
941 
942  // Propagate to children recursively.
943  for (int i = 0; i < children.size(); ++i)
945 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QList< QGraphicsItem * > children

◆ updateChildWithGraphicsEffectFlagRecursively()

void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively ( )

Definition at line 2934 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setGraphicsEffect(), and setParentItemHelper().

2935 {
2936 #ifndef QT_NO_GRAPHICSEFFECT
2937  QGraphicsItemPrivate *itemPrivate = this;
2938  do {
2939  // parent chain already notified?
2940  if (itemPrivate->mayHaveChildWithGraphicsEffect)
2941  return;
2942  itemPrivate->mayHaveChildWithGraphicsEffect = 1;
2943  } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
2944 #endif
2945 }
QGraphicsItem * parent
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
quint32 mayHaveChildWithGraphicsEffect

◆ updatePaintedViewBoundingRects()

void QGraphicsItemPrivate::updatePaintedViewBoundingRects ( bool  updateChildren)

Definition at line 5868 of file qgraphicsitem.cpp.

Referenced by QGraphicsItem::setFlags(), and updatePaintedViewBoundingRects().

5869 {
5870  if (!scene)
5871  return;
5872 
5873  for (int i = 0; i < scene->d_func()->views.size(); ++i) {
5874  QGraphicsViewPrivate *viewPrivate = scene->d_func()->views.at(i)->d_func();
5875  QRect rect = paintedViewBoundingRects.value(viewPrivate->viewport);
5876  rect.translate(viewPrivate->dirtyScrollOffset);
5877  viewPrivate->updateRect(rect);
5878  }
5879 
5880  if (updateChildren) {
5881  for (int i = 0; i < children.size(); ++i)
5883  }
5884 }
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsScene * scene
QList< QGraphicsView * > views() const
Returns a list of all the views that display this scene.
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool updateRect(const QRect &rect)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QMap< QWidget *, QRect > paintedViewBoundingRects
QList< QGraphicsItem * > children
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
void updatePaintedViewBoundingRects(bool updateChildren)

◆ updateSceneTransformFromParent()

void QGraphicsItemPrivate::updateSceneTransformFromParent ( )
virtual

Reimplemented in QDeclarativeFlipablePrivate.

Definition at line 1085 of file qgraphicsitem.cpp.

Referenced by QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QGraphicsSceneIndexPrivate::recursive_items_helper(), and QDeclarativeFlipablePrivate::updateSceneTransformFromParent().

1086 {
1087  if (parent) {
1091  parent->d_ptr->sceneTransform.dy() + pos.y());
1092  } else {
1095  }
1096  if (transformData) {
1099  } else {
1101  }
1102  } else if (!transformData) {
1105  } else if (transformData->onlyTransform) {
1107  if (!pos.isNull())
1110  } else if (pos.isNull()) {
1113  } else {
1116  sceneTransformTranslateOnly = (sceneTransform.type() <= QTransform::TxTranslate);
1117  }
1118  dirtySceneTransform = 0;
1119 }
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QGraphicsItem * parent
QTransform computedFullTransform(QTransform *postmultiplyTransform=0) const
QScopedPointer< QGraphicsItemPrivate > d_ptr
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
quint32 sceneTransformTranslateOnly
bool isNull() const
Returns true if both the x and y coordinates are set to +0.
Definition: qpoint.h:277
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
TransformData * transformData
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

◆ width()

qreal QGraphicsItemPrivate::width ( ) const
virtual

Properties

◆ acceptDrops

quint32 QGraphicsItemPrivate::acceptDrops

Definition at line 543 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::acceptDrops(), and QGraphicsItem::setAcceptDrops().

◆ acceptedMouseButtons

quint32 QGraphicsItemPrivate::acceptedMouseButtons

◆ acceptedTouchBeginEvent

quint32 QGraphicsItemPrivate::acceptedTouchBeginEvent

Definition at line 571 of file qgraphicsitem_p.h.

Referenced by QGraphicsScenePrivate::sendTouchBeginEvent().

◆ acceptsHover

quint32 QGraphicsItemPrivate::acceptsHover

◆ acceptTouchEvents

quint32 QGraphicsItemPrivate::acceptTouchEvents

◆ allChildrenDirty

quint32 QGraphicsItemPrivate::allChildrenDirty

◆ ancestorFlags

quint32 QGraphicsItemPrivate::ancestorFlags

◆ cacheMode

quint32 QGraphicsItemPrivate::cacheMode

◆ children

QList<QGraphicsItem *> QGraphicsItemPrivate::children

◆ childrenBoundingRect

QRectF QGraphicsItemPrivate::childrenBoundingRect

Definition at line 509 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::childrenBoundingRect().

◆ dirty

quint32 QGraphicsItemPrivate::dirty

◆ dirtyChildren

quint32 QGraphicsItemPrivate::dirtyChildren

◆ dirtyChildrenBoundingRect

quint32 QGraphicsItemPrivate::dirtyChildrenBoundingRect

◆ dirtySceneTransform

quint32 QGraphicsItemPrivate::dirtySceneTransform

◆ enabled

quint32 QGraphicsItemPrivate::enabled

Definition at line 539 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::isEnabled(), and QGraphicsItem::setSelected().

◆ explicitActivate

quint32 QGraphicsItemPrivate::explicitActivate

Definition at line 579 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), and QGraphicsItem::setActive().

◆ explicitlyDisabled

quint32 QGraphicsItemPrivate::explicitlyDisabled

Definition at line 540 of file qgraphicsitem_p.h.

Referenced by setEnabledHelper().

◆ explicitlyHidden

quint32 QGraphicsItemPrivate::explicitlyHidden

◆ extras

QList<ExtraStruct> QGraphicsItemPrivate::extras

Definition at line 375 of file qgraphicsitem_p.h.

◆ filtersDescendantEvents

quint32 QGraphicsItemPrivate::filtersDescendantEvents

◆ flags

quint32 QGraphicsItemPrivate::flags

◆ focusProxy

QGraphicsItem* QGraphicsItemPrivate::focusProxy

◆ focusProxyRefs

QList<QGraphicsItem **> QGraphicsItemPrivate::focusProxyRefs

Definition at line 526 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::setFocusProxy().

◆ focusScopeItem

QGraphicsItem* QGraphicsItemPrivate::focusScopeItem

◆ fullUpdatePending

quint32 QGraphicsItemPrivate::fullUpdatePending

◆ geometryChanged

quint32 QGraphicsItemPrivate::geometryChanged

◆ gestureContext

QMap<Qt::GestureType, Qt::GestureFlags> QGraphicsItemPrivate::gestureContext

◆ globalStackingOrder

int QGraphicsItemPrivate::globalStackingOrder

◆ graphicsEffect

QGraphicsEffect* QGraphicsItemPrivate::graphicsEffect

◆ handlesChildEvents

quint32 QGraphicsItemPrivate::handlesChildEvents

◆ hasBoundingRegionGranularity

quint32 QGraphicsItemPrivate::hasBoundingRegionGranularity

◆ hasCursor

quint32 QGraphicsItemPrivate::hasCursor

◆ holesInSiblingIndex

quint32 QGraphicsItemPrivate::holesInSiblingIndex

Definition at line 581 of file qgraphicsitem_p.h.

◆ ignoreOpacity

quint32 QGraphicsItemPrivate::ignoreOpacity

◆ ignoreVisible

quint32 QGraphicsItemPrivate::ignoreVisible

◆ imHints

Qt::InputMethodHints QGraphicsItemPrivate::imHints

Definition at line 529 of file qgraphicsitem_p.h.

◆ inDestructor

quint32 QGraphicsItemPrivate::inDestructor

◆ index

int QGraphicsItemPrivate::index

◆ inSetPosHelper

quint32 QGraphicsItemPrivate::inSetPosHelper

Definition at line 555 of file qgraphicsitem_p.h.

Referenced by markParentDirty(), and QGraphicsItem::prepareGeometryChange().

◆ isDeclarativeItem

quint32 QGraphicsItemPrivate::isDeclarativeItem

◆ isMemberOfGroup

quint32 QGraphicsItemPrivate::isMemberOfGroup

Definition at line 544 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::group().

◆ isObject

quint32 QGraphicsItemPrivate::isObject

◆ isWidget

quint32 QGraphicsItemPrivate::isWidget

◆ itemDepth

int QGraphicsItemPrivate::itemDepth

Definition at line 524 of file qgraphicsitem_p.h.

◆ itemDiscovered

quint32 QGraphicsItemPrivate::itemDiscovered

◆ localCollisionHack

quint32 QGraphicsItemPrivate::localCollisionHack

◆ mayHaveChildWithGraphicsEffect

quint32 QGraphicsItemPrivate::mayHaveChildWithGraphicsEffect

Definition at line 586 of file qgraphicsitem_p.h.

Referenced by updateChildWithGraphicsEffectFlagRecursively().

◆ mouseSetsFocus

quint32 QGraphicsItemPrivate::mouseSetsFocus

◆ needSortChildren

quint32 QGraphicsItemPrivate::needSortChildren

Definition at line 556 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::setFlags(), and QGraphicsItem::setZValue().

◆ needsRepaint

QRectF QGraphicsItemPrivate::needsRepaint

◆ notifyBoundingRectChanged

quint32 QGraphicsItemPrivate::notifyBoundingRectChanged

◆ notifyInvalidated

quint32 QGraphicsItemPrivate::notifyInvalidated

◆ opacity

qreal QGraphicsItemPrivate::opacity

◆ padding

quint32 QGraphicsItemPrivate::padding

Definition at line 589 of file qgraphicsitem_p.h.

◆ paintedViewBoundingRects

QMap<QWidget *, QRect> QGraphicsItemPrivate::paintedViewBoundingRects

◆ paintedViewBoundingRectsNeedRepaint

quint32 QGraphicsItemPrivate::paintedViewBoundingRectsNeedRepaint

◆ panelModality

QGraphicsItem::PanelModality QGraphicsItemPrivate::panelModality

◆ parent

QGraphicsItem* QGraphicsItemPrivate::parent

◆ pendingPolish

quint32 QGraphicsItemPrivate::pendingPolish

◆ pos

QPointF QGraphicsItemPrivate::pos

◆ q_ptr

QGraphicsItem* QGraphicsItemPrivate::q_ptr

Definition at line 593 of file qgraphicsitem_p.h.

Referenced by QGraphicsItem::QGraphicsItem(), and updateHelper().

◆ scene

QGraphicsScene* QGraphicsItemPrivate::scene

Definition at line 515 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), QGraphicsItem::addToIndex(), QGraphicsItem::collidingItems(), QGraphicsItem::ensureVisible(), QGraphicsObject::grabGesture(), QGraphicsItem::grabKeyboard(), QGraphicsItem::grabMouse(), QGraphicsItem::hasFocus(), QGraphicsItem::installSceneEventFilter(), QGraphicsItem::isActive(), QGraphicsItem::isBlockedByModalPanel(), markParentDirty(), QGraphicsItem::mouseMoveEvent(), QGraphicsItem::mousePressEvent(), QGraphicsItem::mouseReleaseEvent(), QGraphicsWidgetPrivate::naturalWidgetFont(), QGraphicsWidgetPrivate::naturalWidgetPalette(), QGraphicsItem::prepareGeometryChange(), QGraphicsItem::removeFromIndex(), QGraphicsItem::removeSceneEventFilter(), QGraphicsWidgetPrivate::resolveLayoutDirection(), QGraphicsItem::scene(), QGraphicsItem::sceneEvent(), QGraphicsItem::setAcceptedMouseButtons(), QGraphicsItem::setAcceptHoverEvents(), QGraphicsItem::setAcceptTouchEvents(), QGraphicsItem::setActive(), QGraphicsItem::setCursor(), QGraphicsItem::setFlags(), QGraphicsItem::setFocusProxy(), QGraphicsWidget::setGeometry(), QGraphicsItem::setOpacity(), QGraphicsItem::setPanelModality(), QGraphicsItem::setSelected(), QGraphicsItem::setZValue(), QGraphicsItem::stackBefore(), QGraphicsProxyWidgetPrivate::unembedSubWindow(), QGraphicsObject::ungrabGesture(), QGraphicsItem::ungrabKeyboard(), QGraphicsItem::ungrabMouse(), QGraphicsItem::unsetCursor(), QGraphicsItem::update(), and QGraphicsItem::~QGraphicsItem().

◆ scenePosDescendants

quint32 QGraphicsItemPrivate::scenePosDescendants

◆ sceneTransform

QTransform QGraphicsItemPrivate::sceneTransform

◆ sceneTransformTranslateOnly

quint32 QGraphicsItemPrivate::sceneTransformTranslateOnly

◆ selected

quint32 QGraphicsItemPrivate::selected

◆ sendParentChangeNotification

quint32 QGraphicsItemPrivate::sendParentChangeNotification

Definition at line 588 of file qgraphicsitem_p.h.

Referenced by children_append(), and children_clear().

◆ sequentialOrdering

quint32 QGraphicsItemPrivate::sequentialOrdering

Definition at line 582 of file qgraphicsitem_p.h.

◆ siblingIndex

int QGraphicsItemPrivate::siblingIndex

◆ subFocusItem

QGraphicsItem* QGraphicsItemPrivate::subFocusItem

Definition at line 527 of file qgraphicsitem_p.h.

Referenced by clearSubFocus(), QGraphicsItem::focusItem(), and setSubFocus().

◆ transformData

TransformData* QGraphicsItemPrivate::transformData

◆ updateDueToGraphicsEffect

quint32 QGraphicsItemPrivate::updateDueToGraphicsEffect

◆ visible

quint32 QGraphicsItemPrivate::visible

◆ wantsActive

quint32 QGraphicsItemPrivate::wantsActive

Definition at line 580 of file qgraphicsitem_p.h.

Referenced by QGraphicsScene::addItem(), and QGraphicsItem::setActive().

◆ z

qreal QGraphicsItemPrivate::z

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