4#ifndef QGRAPHICSITEM_P_H
5#define QGRAPHICSITEM_P_H
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
22#include <private/qgraphicsview_p.h>
24#include <private/qgraphicstransform_p.h>
26#include <QtCore/qpoint.h>
70 ExtraBoundingRegionGranularity
75 AncestorHandlesChildEvents = 0x1,
76 AncestorClipsChildren = 0x2,
77 AncestorIgnoresTransformations = 0x4,
78 AncestorFiltersChildEvents = 0x8,
79 AncestorContainsChildren = 0x10
94 void updateChildWithGraphicsEffectFlagRecursively();
96 AncestorFlag flag = NoFlag,
bool enabled =
false,
bool root =
true);
97 void updateAncestorFlags();
98 void setIsMemberOfGroup(
bool enabled);
105 || (ancestorFlags & AncestorIgnoresTransformations);
110 virtual void updateSceneTransformFromParent();
114 virtual void setPosHelper(
const QPointF &
pos);
118 void setVisibleHelper(
bool newVisible,
bool explicitly,
bool update =
true,
119 bool hiddenByPanel =
false);
120 void setEnabledHelper(
bool newEnabled,
bool explicitly,
bool update =
true);
121 bool discardUpdateRequest(
bool ignoreVisibleBit =
false,
122 bool ignoreDirtyBit =
false,
bool ignoreOpacity =
false)
const;
125#if QT_CONFIG(graphicseffect)
126 enum InvalidateReason {
129 void invalidateParentGraphicsEffectsRecursively();
130 void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
132 void invalidateDepthRecursively();
137 const QVariant *thisPointerVariant);
140 const QRegion &exposedRegion,
bool allItems =
false)
const;
142 QRectF sceneEffectiveBoundingRect()
const;
148 for (
int i = 0;
i < children.size(); ++
i)
149 children.at(
i)->d_ptr->resolveFont(inheritedMask);
154 for (
int i = 0;
i < children.size(); ++
i)
155 children.at(
i)->d_ptr->resolvePalette(inheritedMask);
158 virtual bool isProxyWidget()
const;
162 for (
int i = 0;
i < extras.size(); ++
i) {
173 for (
int i = 0;
i < extras.size(); ++
i) {
174 if (extras.at(
i).type ==
type) {
189 for (
int i = 0;
i < extras.size(); ++
i) {
190 if (extras.at(
i).type ==
type) {
207 {
return type < extra; }
214 void removeExtraItemCache();
216 void updatePaintedViewBoundingRects(
bool updateChildren);
217 void ensureSceneTransformRecursive(
QGraphicsItem **topMostDirtyItem);
221 ensureSceneTransformRecursive(&that);
226 ensureSceneTransform();
227 return sceneTransformTranslateOnly;
232 for (
int i = 0;
i < children.size(); ++
i)
233 children.at(
i)->d_ptr->dirtySceneTransform = 1;
242 int parentFlags =
p->d_ptr->flags;
252 o *=
p->d_ptr->opacity;
253 p =
p->d_ptr->parent;
254 myFlags = parentFlags;
260 {
return (opacity <
qreal(0.001)); }
263 {
return (opacity <
qreal(0.001)); }
272 return isOpacityNull(calcEffectiveOpacity());
279 return calcEffectiveOpacity();
286 return parentOpacity * opacity;
293 if (!children.size())
298 for (
int i = 0;
i < children.size(); ++
i) {
310 return !visible || (childrenCombineOpacity() && isFullyTransparent());
313 inline void markParentDirty(
bool updateBoundingRect =
false);
315 void setFocusHelper(
Qt::FocusReason focusReason,
bool climb,
bool focusFromHide);
316 void clearFocusHelper(
bool giveFocusToParent,
bool hiddenByParentPanel);
319 void resetFocusProxy();
320 virtual void subFocusItemChange();
321 virtual void focusScopeItemChange(
bool isSubFocusItem);
324 inline void ensureSortedChildren();
326 void ensureSequentialSiblingIndex();
327 inline void sendScenePosChange();
328 virtual void siblingOrderChange();
332 virtual void setWidth(
qreal);
333 virtual void resetWidth();
336 virtual void setHeight(
qreal);
337 virtual void resetHeight();
361#ifndef QT_NO_GESTURES
447 if (!postmultiplyTransform || postmultiplyTransform->isIdentity())
450 return *postmultiplyTransform;
451 return transform * *postmultiplyTransform;
459 x *=
m.toTransform();
465 if (postmultiplyTransform)
466 x *= *postmultiplyTransform;
493#if QT_CONFIG(graphicseffect)
530 {
return info ?
info->option :
nullptr; }
535 qWarning(
"QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context");
538 return info->widget->rect();
565 if (
d1->parent ==
d2->parent)
570 int item1Depth =
d1->depth();
571 int item2Depth =
d2->depth();
574 while (item1Depth > item2Depth && (
p =
p->d_ptr->parent)) {
584 while (item2Depth > item1Depth && (
p =
p->d_ptr->parent)) {
599 t1 =
t1->d_ptr->parent;
600 t2 =
t2->d_ptr->parent;
632 return d1->z >
d2->z;
633 return d1->siblingIndex >
d2->siblingIndex;
677 return a->d_ptr->siblingIndex <
b->d_ptr->siblingIndex;
686#if QT_CONFIG(graphicseffect)
689 static_cast<QGraphicsItemEffectSourcePrivate *
>(parentp->
graphicsEffect->d_func()
690 ->
source->d_func())->invalidateCache();
697 if (updateBoundingRect) {
702#if QT_CONFIG(graphicseffect)
704 if (updateBoundingRect) {
705 static_cast<QGraphicsItemEffectSourcePrivate *
>(parentp->
graphicsEffect->d_func()
706 ->
source->d_func())->invalidateCache();
virtual const QGraphicsItem * graphicsItem() const =0
virtual bool isPixmap() const =0
QGraphicsEffectSourcePrivate()
virtual QRectF boundingRect(Qt::CoordinateSystem system) const =0
virtual const QStyleOption * styleOption() const =0
virtual void draw(QPainter *p)=0
virtual QRect deviceRect() const =0
virtual void effectBoundingRectChanged()=0
virtual const QWidget * widget() const =0
The QGraphicsEffect class is the base class for all graphics effects.
PixmapPadMode
This enum describes how the pixmap returned from sourcePixmap should be padded.
QGraphicsEffectSource * source() const
QHash< QPaintDevice *, DeviceData > deviceData
quint32 localCollisionHack
bool isOpacityNull() const
QGraphicsItem * subFocusItem
void invalidateChildrenSceneTransform()
QVariant extra(Extra type) const
quint32 dirtySceneTransform
static bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b)
Qt::InputMethodHints imHints
QList< QGraphicsItem ** > focusProxyRefs
QTransform transformToParent() const
QGraphicsEffect * graphicsEffect
@ ExtraMaxDeviceCoordCacheSize
QGraphicsItem * focusProxy
void markParentDirty(bool updateBoundingRect=false)
QGraphicsItem * focusScopeItem
quint32 explicitlyDisabled
void combineTransformToParent(QTransform *x, const QTransform *viewTransform=nullptr) const
quint32 notifyInvalidated
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
bool itemIsUntransformable() const
quint32 filtersDescendantEvents
QList< ExtraStruct > extras
quint32 mayHaveChildWithGraphicsEffect
quint32 acceptedMouseButtons
quint32 dirtyChildrenBoundingRect
static QGraphicsItemPrivate * get(QGraphicsItem *item)
void setExtra(Extra type, const QVariant &value)
QGraphicsItem::PanelModality panelModality
virtual void transformChanged()
bool childrenCombineOpacity() const
void ensureSceneTransform()
QList< QGraphicsItem * > children
quint32 updateDueToGraphicsEffect
quint32 hasBoundingRegionGranularity
quint32 acceptedTouchBeginEvent
quint32 sceneTransformTranslateOnly
quint32 sendParentChangeNotification
quint32 scenePosDescendants
bool isFullyTransparent() const
quint32 acceptTouchEvents
bool childrenClippedToShape() const
quint32 sequentialOrdering
quint32 paintedViewBoundingRectsNeedRepaint
bool hasTranslateOnlySceneTransform()
QRectF childrenBoundingRect
quint32 holesInSiblingIndex
virtual void resolvePalette(uint inheritedMask)
qreal effectiveOpacity() const
quint32 handlesChildEvents
quint32 notifyBoundingRectChanged
TransformData * transformData
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
QTransform sceneTransform
QHash< QWidget *, QRect > paintedViewBoundingRects
virtual void resolveFont(uint inheritedMask)
qreal combineOpacityFromParent(qreal parentOpacity) const
void unsetExtra(Extra type)
qreal calcEffectiveOpacity() const
void ensureSortedChildren()
static bool isOpacityNull(qreal opacity)
quint32 fullUpdatePending
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QScopedPointer< QGraphicsItemPrivate > d_ptr
void update(const QRectF &rect=QRectF())
Schedules a redraw of the area covered by rect in this item.
GraphicsItemFlag
This enum describes different flags that you can set on an item to toggle different features in the i...
@ ItemDoesntPropagateOpacityToChildren
@ ItemIgnoresTransformations
@ ItemClipsChildrenToShape
@ ItemIgnoresParentOpacity
void prepareGeometryChange()
Prepares the item for a geometry change.
virtual int type() const
Returns the type of an item as an int.
GraphicsItemFlags flags() const
Returns this item's flags.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QPainter class performs low-level painting on widgets and other paint devices.
The QPixmapCache::Key class can be used for efficient access to the QPixmapCache.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
The QStyleOption class stores the parameters used by QStyle functions.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qt_closestItemLast(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item2 is on top of item1.
bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item1 is on top of item2.
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLenum GLuint GLintptr offset
GLuint GLenum GLenum transform
GLenum GLenum GLenum GLenum GLenum scale
const QQuickItem * rootItem(const I &item)
#define QT_REQUIRE_CONFIG(feature)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QFileInfo info(fileName)
[8]
view viewport() -> scroll(dx, dy, deviceRect)
const QTransform * transformPtr
const QTransform * effectTransform
quint32 wasDirtySceneTransform
QGraphicsItemPaintInfo(const QTransform *const xform1, const QTransform *const xform2, const QTransform *const xform3, QRegion *r, QWidget *w, QStyleOptionGraphicsItem *opt, QPainter *p, qreal o, bool b1, bool b2)
QStyleOptionGraphicsItem * option
const QTransform * viewTransform
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent