Changeset 846 for trunk/src/gui/graphicsview/qgraphicsitem_p.h
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/graphicsview/qgraphicsitem_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 71 71 72 72 class QGraphicsItemPrivate; 73 74 #ifndef QDECLARATIVELISTPROPERTY 75 #define QDECLARATIVELISTPROPERTY 76 template<typename T> 77 class QDeclarativeListProperty { 78 public: 79 typedef void (*AppendFunction)(QDeclarativeListProperty<T> *, T*); 80 typedef int (*CountFunction)(QDeclarativeListProperty<T> *); 81 typedef T *(*AtFunction)(QDeclarativeListProperty<T> *, int); 82 typedef void (*ClearFunction)(QDeclarativeListProperty<T> *); 83 84 QDeclarativeListProperty() 85 : object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {} 86 QDeclarativeListProperty(QObject *o, QList<T *> &list) 87 : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), 88 clear(qlist_clear), dummy1(0), dummy2(0) {} 89 QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0, 90 ClearFunction r = 0) 91 : object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {} 92 93 bool operator==(const QDeclarativeListProperty &o) const { 94 return object == o.object && 95 data == o.data && 96 append == o.append && 97 count == o.count && 98 at == o.at && 99 clear == o.clear; 100 } 101 102 QObject *object; 103 void *data; 104 105 AppendFunction append; 106 107 CountFunction count; 108 AtFunction at; 109 110 ClearFunction clear; 111 112 void *dummy1; 113 void *dummy2; 114 115 private: 116 static void qlist_append(QDeclarativeListProperty *p, T *v) { 117 ((QList<T *> *)p->data)->append(v); 118 } 119 static int qlist_count(QDeclarativeListProperty *p) { 120 return ((QList<T *> *)p->data)->count(); 121 } 122 static T *qlist_at(QDeclarativeListProperty *p, int idx) { 123 return ((QList<T *> *)p->data)->at(idx); 124 } 125 static void qlist_clear(QDeclarativeListProperty *p) { 126 return ((QList<T *> *)p->data)->clear(); 127 } 128 }; 129 #endif 73 130 74 131 class QGraphicsItemCache … … 157 214 allChildrenDirty(0), 158 215 fullUpdatePending(0), 216 dirtyChildrenBoundingRect(1), 159 217 flags(0), 160 dirtyChildrenBoundingRect(1),161 218 paintedViewBoundingRectsNeedRepaint(0), 162 219 dirtySceneTransform(1), … … 181 238 pendingPolish(0), 182 239 mayHaveChildWithGraphicsEffect(0), 240 isDeclarativeItem(0), 241 sendParentChangeNotification(0), 183 242 globalStackingOrder(-1), 184 243 q_ptr(0) … … 221 280 virtual void setPosHelper(const QPointF &pos); 222 281 void setTransformHelper(const QTransform &transform); 282 void prependGraphicsTransform(QGraphicsTransform *t); 223 283 void appendGraphicsTransform(QGraphicsTransform *t); 224 284 void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); … … 226 286 bool discardUpdateRequest(bool ignoreVisibleBit = false, 227 287 bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; 288 virtual void transformChanged() {} 228 289 int depth() const; 229 290 #ifndef QT_NO_GRAPHICSEFFECT … … 238 299 void addChild(QGraphicsItem *child); 239 300 void removeChild(QGraphicsItem *child); 301 QDeclarativeListProperty<QGraphicsObject> childrenList(); 240 302 void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, 241 303 const QVariant *thisPointerVariant); 242 void childrenBoundingRectHelper(QTransform *x, QRectF *rect );304 void childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem); 243 305 void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, 244 306 const QRegion &exposedRegion, bool allItems = false) const; 245 QRectF effectiveBoundingRect( ) const;307 QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem = 0) const; 246 308 QRectF sceneEffectiveBoundingRect() const; 247 309 … … 317 379 void removeExtraItemCache(); 318 380 381 void updatePaintedViewBoundingRects(bool updateChildren); 319 382 void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem); 320 383 inline void ensureSceneTransform() … … 415 478 inline void markParentDirty(bool updateBoundingRect = false); 416 479 417 void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFrom Show);480 void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide); 418 481 void clearFocusHelper(bool giveFocusToParent); 419 void setSubFocus(QGraphicsItem *rootItem = 0 );420 void clearSubFocus(QGraphicsItem *rootItem = 0 );482 void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); 483 void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); 421 484 void resetFocusProxy(); 422 485 virtual void subFocusItemChange(); 486 virtual void focusScopeItemChange(bool isSubFocusItem); 487 488 static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item); 489 static int children_count(QDeclarativeListProperty<QGraphicsObject> *list); 490 static QGraphicsObject *children_at(QDeclarativeListProperty<QGraphicsObject> *list, int); 491 static void children_clear(QDeclarativeListProperty<QGraphicsObject> *list); 423 492 424 493 inline QTransform transformToParent() const; … … 428 497 inline void sendScenePosChange(); 429 498 virtual void siblingOrderChange(); 499 500 // Private Properties 501 virtual qreal width() const; 502 virtual void setWidth(qreal); 503 virtual void resetWidth(); 504 505 virtual qreal height() const; 506 virtual void setHeight(qreal); 507 virtual void resetHeight(); 430 508 431 509 QRectF childrenBoundingRect; … … 451 529 Qt::InputMethodHints imHints; 452 530 QGraphicsItem::PanelModality panelModality; 531 #ifndef QT_NO_GESTURES 453 532 QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; 533 #endif 454 534 455 535 // Packed 32 bits … … 476 556 quint32 needSortChildren : 1; 477 557 quint32 allChildrenDirty : 1; 558 quint32 fullUpdatePending : 1; 559 quint32 dirtyChildrenBoundingRect : 1; 478 560 479 561 // Packed 32 bits 480 quint32 fullUpdatePending : 1; 481 quint32 flags : 17; 482 quint32 dirtyChildrenBoundingRect : 1; 562 quint32 flags : 18; 483 563 quint32 paintedViewBoundingRectsNeedRepaint : 1; 484 564 quint32 dirtySceneTransform : 1; … … 494 574 quint32 notifyBoundingRectChanged : 1; 495 575 quint32 notifyInvalidated : 1; 576 quint32 mouseSetsFocus : 1; 496 577 497 578 // New 32 bits 498 quint32 mouseSetsFocus : 1;499 579 quint32 explicitActivate : 1; 500 580 quint32 wantsActive : 1; … … 505 585 quint32 pendingPolish : 1; 506 586 quint32 mayHaveChildWithGraphicsEffect : 1; 587 quint32 isDeclarativeItem : 1; 588 quint32 sendParentChangeNotification : 1; 589 quint32 padding : 22; 507 590 508 591 // Optional stacking order … … 610 693 && !(item->flags() & QGraphicsItem::ItemIsSelectable) 611 694 && item->d_ptr->children.size() == 0; 612 //|| (item->d_ptr->isObject && qobject_cast<Q mlGraphicsImage *>(q_func()));695 //|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func())); 613 696 } 614 697 … … 640 723 /*! 641 724 Returns true if \a item1 is on top of \a item2. 642 The items don t need to be siblings.725 The items don't need to be siblings. 643 726 644 727 \internal … … 694 777 /*! 695 778 Returns true if \a item2 is on top of \a item1. 696 The items don t need to be siblings.779 The items don't need to be siblings. 697 780 698 781 \internal … … 789 872 if (parentp->graphicsEffect) { 790 873 if (updateBoundingRect) { 791 parentp->notifyInvalidated = 1;792 874 static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func() 793 875 ->source->d_func())->invalidateCache(); 876 parentp->notifyInvalidated = 1; 794 877 } 795 if (parentp-> graphicsEffect->isEnabled()) {878 if (parentp->scene && parentp->graphicsEffect->isEnabled()) { 796 879 parentp->dirty = 1; 797 880 parentp->fullUpdatePending = 1;
Note:
See TracChangeset
for help on using the changeset viewer.