42 #ifndef QGRAPHICSITEM_P_H 43 #define QGRAPHICSITEM_P_H 59 #include <private/qgraphicsview_p.h> 61 #include <private/qgraphicstransform_p.h> 63 #include <private/qgraphicseffect_p.h> 66 #include <QtCore/qpoint.h> 68 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW 74 #ifndef QDECLARATIVELISTPROPERTY 75 #define QDECLARATIVELISTPROPERTY 81 typedef T *(*AtFunction)(QDeclarativeListProperty<T> *, int);
94 return object == o.
object &&
167 ExtraBoundingRegionGranularity
172 AncestorHandlesChildEvents = 0x1,
173 AncestorClipsChildren = 0x2,
174 AncestorIgnoresTransformations = 0x4,
175 AncestorFiltersChildEvents = 0x8
193 acceptedMouseButtons(0x1f),
197 explicitlyDisabled(0),
202 handlesChildEvents(0),
207 hasBoundingRegionGranularity(0),
211 localCollisionHack(0),
215 fullUpdatePending(0),
216 dirtyChildrenBoundingRect(1),
218 paintedViewBoundingRectsNeedRepaint(0),
219 dirtySceneTransform(1),
225 acceptTouchEvents(0),
226 acceptedTouchBeginEvent(0),
227 filtersDescendantEvents(0),
228 sceneTransformTranslateOnly(0),
229 notifyBoundingRectChanged(0),
230 notifyInvalidated(0),
234 holesInSiblingIndex(0),
235 sequentialOrdering(1),
236 updateDueToGraphicsEffect(0),
237 scenePosDescendants(0),
239 mayHaveChildWithGraphicsEffect(0),
240 isDeclarativeItem(0),
241 sendParentChangeNotification(0),
242 globalStackingOrder(-1),
252 return item->d_ptr.data();
256 return item->d_ptr.data();
259 void updateChildWithGraphicsEffectFlagRecursively();
262 void updateAncestorFlags();
263 void setIsMemberOfGroup(
bool enabled);
269 || (ancestorFlags & AncestorIgnoresTransformations);
274 virtual void updateSceneTransformFromParent();
278 static bool movableAncestorIsSelected(
const QGraphicsItem *item);
280 virtual void setPosHelper(
const QPointF &pos);
281 void setTransformHelper(
const QTransform &transform);
284 void setVisibleHelper(
bool newVisible,
bool explicitly,
bool update =
true);
285 void setEnabledHelper(
bool newEnabled,
bool explicitly,
bool update =
true);
286 bool discardUpdateRequest(
bool ignoreVisibleBit =
false,
287 bool ignoreDirtyBit =
false,
bool ignoreOpacity =
false)
const;
290 #ifndef QT_NO_GRAPHICSEFFECT 294 void invalidateParentGraphicsEffectsRecursively();
296 #endif //QT_NO_GRAPHICSEFFECT 297 void invalidateDepthRecursively();
303 const QVariant *thisPointerVariant);
306 const QRegion &exposedRegion,
bool allItems =
false)
const;
308 QRectF sceneEffectiveBoundingRect()
const;
314 for (
int i = 0; i < children.size(); ++i)
315 children.at(i)->d_ptr->resolveFont(inheritedMask);
320 for (
int i = 0; i < children.size(); ++i)
321 children.at(i)->d_ptr->resolveFont(inheritedMask);
324 virtual bool isProxyWidget()
const;
328 for (
int i = 0; i < extras.size(); ++i) {
330 if (extra.
type == type)
339 for (
int i = 0; i < extras.size(); ++i) {
340 if (extras.at(i).type ==
type) {
349 extras[
index].value = value;
355 for (
int i = 0; i < extras.size(); ++i) {
356 if (extras.at(i).type ==
type) {
365 : type(type), value(value)
372 {
return type < extra; }
379 void removeExtraItemCache();
381 void updatePaintedViewBoundingRects(
bool updateChildren);
382 void ensureSceneTransformRecursive(
QGraphicsItem **topMostDirtyItem);
386 ensureSceneTransformRecursive(&that);
391 ensureSceneTransform();
392 return sceneTransformTranslateOnly;
397 for (
int i = 0; i < children.size(); ++i)
398 children.at(i)->d_ptr->dirtySceneTransform = 1;
419 myFlags = parentFlags;
425 {
return (opacity <
qreal(0.001)); }
428 {
return (opacity <
qreal(0.001)); }
437 return isOpacityNull(calcEffectiveOpacity());
441 if (!parent || !opacity)
444 return calcEffectiveOpacity();
451 return parentOpacity * opacity;
458 if (!children.size())
463 for (
int i = 0; i < children.size(); ++i) {
475 return !visible || (childrenCombineOpacity() && isFullyTransparent());
478 inline void markParentDirty(
bool updateBoundingRect =
false);
480 void setFocusHelper(
Qt::FocusReason focusReason,
bool climb,
bool focusFromHide);
481 void clearFocusHelper(
bool giveFocusToParent);
484 void resetFocusProxy();
485 virtual void subFocusItemChange();
486 virtual void focusScopeItemChange(
bool isSubFocusItem);
494 inline void ensureSortedChildren();
496 void ensureSequentialSiblingIndex();
497 inline void sendScenePosChange();
498 virtual void siblingOrderChange();
501 virtual qreal width()
const;
502 virtual void setWidth(
qreal);
503 virtual void resetWidth();
505 virtual qreal height()
const;
506 virtual void setHeight(
qreal);
507 virtual void resetHeight();
531 #ifndef QT_NO_GESTURES 607 scale(1.0), rotation(0.0),
608 xOrigin(0.0), yOrigin(0.0),
615 if (!postmultiplyTransform || postmultiplyTransform->isIdentity())
618 return *postmultiplyTransform;
619 return transform * *postmultiplyTransform;
623 if (!graphicsTransforms.
isEmpty()) {
625 for (
int i = 0; i < graphicsTransforms.
size(); ++i)
631 x.
scale(scale, scale);
633 if (postmultiplyTransform)
634 x *= *postmultiplyTransform;
645 : viewTransform(xform1), transformPtr(xform2), effectTransform(xform3), exposedRegion(r),
widget(w),
646 option(opt), painter(p), opacity(o), wasDirtySceneTransform(b1), drawItem(b2)
661 #ifndef QT_NO_GRAPHICSEFFECT 671 item->d_ptr->graphicsEffect = 0;
672 item->prepareGeometryChange();
682 item->d_ptr->updateDueToGraphicsEffect =
true;
684 item->d_ptr->updateDueToGraphicsEffect =
false;
688 { item->prepareGeometryChange(); }
694 && item->d_ptr->children.size() == 0;
704 qWarning(
"QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context");
707 return info->widget->rect();
721 #endif //QT_NO_GRAPHICSEFFECT 739 int item1Depth = d1->
depth();
740 int item2Depth = d2->
depth();
743 while (item1Depth > item2Depth && (p = p->
d_ptr->
parent)) {
753 while (item2Depth > item1Depth && (p = p->
d_ptr->
parent)) {
765 while (t1 && t1 != t2) {
801 return d1->
z > d2->
z;
817 combineTransformToParent(&matrix);
826 if (needSortChildren) {
827 needSortChildren = 0;
828 sequentialOrdering = 1;
829 if (children.isEmpty())
832 for (
int i = 0; i < children.size(); ++i) {
833 if (children.at(i)->d_ptr->siblingIndex != i) {
834 sequentialOrdering = 0;
855 #ifndef QT_NO_GRAPHICSEFFECT 859 ->
source->d_func())->invalidateCache();
866 if (updateBoundingRect) {
871 #ifndef QT_NO_GRAPHICSEFFECT 873 if (updateBoundingRect) {
875 ->
source->d_func())->invalidateCache();
889 #endif // QT_NO_GRAPHICSVIEW The QVariant class acts like a union for the most common Qt data types.
void unsetExtra(Extra type)
The QPainter class performs low-level painting on widgets and other paint devices.
quint32 explicitlyDisabled
const QTransform * transformPtr
quint32 sendParentChangeNotification
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items...
QMap< QPaintDevice *, DeviceData > deviceData
QGraphicsItem * subFocusItem
qreal combineOpacityFromParent(qreal parentOpacity) const
quint32 handlesChildEvents
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
QGraphicsItemEffectSourcePrivate(QGraphicsItem *i)
QGraphicsItem::PanelModality panelModality
QPointer< QWidget > widget
QScopedPointer< QGraphicsItemPrivate > d_ptr
T * data() const
Returns the value of the pointer referenced by this object.
bool hasTranslateOnlySceneTransform()
Qt::InputMethodHints imHints
QList< QGraphicsItem ** > focusProxyRefs
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QTransform lastEffectTransform
bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
quint32 notifyInvalidated
void ensureSortedChildren()
static void qlist_append(QDeclarativeListProperty *p, T *v)
GraphicsItemFlag
This enum describes different flags that you can set on an item to toggle different features in the i...
long ASN1_INTEGER_get ASN1_INTEGER * a
const QWidget * widget() const
bool isOpacityNull() const
static int qlist_count(QDeclarativeListProperty *p)
static bool isOpacityNull(qreal opacity)
The QObject class is the base class of all Qt objects.
const QStyleOption * styleOption() const
quint32 sequentialOrdering
quint32 dirtySceneTransform
quint32 dirtyChildrenBoundingRect
bool operator==(const QDeclarativeListProperty &o) const
T *(* AtFunction)(QDeclarativeListProperty< T > *, int)
Synonym for {T *(*)(QDeclarativeListProperty<T> *property, int index)}.
bool childrenClippedToShape() const
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c=0, AtFunction t=0, ClearFunction r=0)
quint32 acceptedMouseButtons
QList< ExtraStruct > extras
quint32 acceptedTouchBeginEvent
QRectF childrenBoundingRect
bool qt_closestItemLast(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item2 is on top of item1.
static const QRectF boundingRect(const QPointF *points, int pointCount)
quint32 wasDirtySceneTransform
quint32 localCollisionHack
quint32 hasBoundingRegionGranularity
bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item1 is on top of item2.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const QGraphicsItem * graphicsItem() const
The QRectF class defines a rectangle in the plane using floating point precision. ...
The QStyleOption class stores the parameters used by QStyle functions.
void invalidateChildrenSceneTransform()
bool itemIsUntransformable() const
quint32 fullUpdatePending
quint32 sceneTransformTranslateOnly
quint32 paintedViewBoundingRectsNeedRepaint
const T & at(int i) const
Returns the item at index position i in the list.
QGraphicsEffect * graphicsEffect
Q_CORE_EXPORT void qWarning(const char *,...)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
quint32 filtersDescendantEvents
static void qlist_clear(QDeclarativeListProperty *p)
The QRegion class specifies a clip region for a painter.
virtual void resolvePalette(uint inheritedMask)
const QTransform * viewTransform
static bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b)
PixmapPadMode
This enum describes how the pixmap returned from sourcePixmap should be padded.
int(* CountFunction)(QDeclarativeListProperty< T > *)
Synonym for {int (*)(QDeclarativeListProperty<T> *property)}.
QVariant extra(Extra type) const
virtual ~QGraphicsItemPrivate()
void qSort(RandomAccessIterator start, RandomAccessIterator end)
void effectBoundingRectChanged()
quint32 mayHaveChildWithGraphicsEffect
quint32 updateDueToGraphicsEffect
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
QTransform toTransform() const
Returns the conventional Qt 2D transformation matrix that corresponds to this matrix.
quint32 holesInSiblingIndex
void(* ClearFunction)(QDeclarativeListProperty< T > *)
Synonym for {void (*)(QDeclarativeListProperty<T> *property)}.
QStyleOptionGraphicsItem * option
QTransform sceneTransform
const QTransform * effectTransform
The QPixmapCache::Key class can be used for efficient access to the QPixmapCache. ...
#define Q_DECLARE_PUBLIC(Class)
quint32 notifyBoundingRectChanged
void ensureSceneTransform()
virtual void transformChanged()
QGraphicsItem * focusScopeItem
The QPoint class defines a point in the plane using integer precision.
quint32 acceptTouchEvents
static T * qlist_at(QDeclarativeListProperty *p, int idx)
int size() const
Returns the number of items in the list.
bool isFullyTransparent() const
void setExtra(Extra type, const QVariant &value)
The QRect class defines a rectangle in the plane using integer precision.
virtual void resolveFont(uint inheritedMask)
QVector< QRectF > exposed
void(* AppendFunction)(QDeclarativeListProperty< T > *, T *)
Synonym for {void (*)(QDeclarativeListProperty<T> *property, T *value)}.
The QPixmap class is an off-screen image representation that can be used as a paint device...
QGraphicsItemPaintInfo * info
TransformData * transformData
QMap< QWidget *, QRect > paintedViewBoundingRects
The QSize class defines the size of a two-dimensional object using integer point precision.
quint32 scenePosDescendants
QTransform transformToParent() const
quint32 isDeclarativeItem
QList< QGraphicsItem * > children
QGraphicsItem * focusProxy
PanelModality
This enum specifies the behavior of a modal panel.
The QGraphicsObject class provides a base class for all graphics items that require signals...
void markParentDirty(bool updateBoundingRect=false)
The QEvent class is the base class of all event classes.
QGraphicsEffectSource * source() const
Returns a pointer to the source, which provides extra context information that can be useful for the ...
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
QDeclarativeListProperty(QObject *o, QList< T *> &list)
qreal calcEffectiveOpacity() const
QDeclarativeListProperty()
The QDeclarativeListProperty class allows applications to expose list-like properties to QML...
bool childrenCombineOpacity() const
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)
The QMap class is a template class that provides a skip-list-based dictionary.
The QGraphicsEffect class is the base class for all graphics effects.
bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
The QList class is a template class that provides lists.
qreal effectiveOpacity() const