Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/graphicsview/qgraphicsitem_p.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    7171
    7272class QGraphicsItemPrivate;
     73
     74#ifndef QDECLARATIVELISTPROPERTY
     75#define QDECLARATIVELISTPROPERTY
     76template<typename T>
     77class QDeclarativeListProperty {
     78public:
     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
     115private:
     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
    73130
    74131class QGraphicsItemCache
     
    157214        allChildrenDirty(0),
    158215        fullUpdatePending(0),
     216        dirtyChildrenBoundingRect(1),
    159217        flags(0),
    160         dirtyChildrenBoundingRect(1),
    161218        paintedViewBoundingRectsNeedRepaint(0),
    162219        dirtySceneTransform(1),
     
    181238        pendingPolish(0),
    182239        mayHaveChildWithGraphicsEffect(0),
     240        isDeclarativeItem(0),
     241        sendParentChangeNotification(0),
    183242        globalStackingOrder(-1),
    184243        q_ptr(0)
     
    221280    virtual void setPosHelper(const QPointF &pos);
    222281    void setTransformHelper(const QTransform &transform);
     282    void prependGraphicsTransform(QGraphicsTransform *t);
    223283    void appendGraphicsTransform(QGraphicsTransform *t);
    224284    void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
     
    226286    bool discardUpdateRequest(bool ignoreVisibleBit = false,
    227287                              bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
     288    virtual void transformChanged() {}
    228289    int depth() const;
    229290#ifndef QT_NO_GRAPHICSEFFECT
     
    238299    void addChild(QGraphicsItem *child);
    239300    void removeChild(QGraphicsItem *child);
     301    QDeclarativeListProperty<QGraphicsObject> childrenList();
    240302    void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant,
    241303                             const QVariant *thisPointerVariant);
    242     void childrenBoundingRectHelper(QTransform *x, QRectF *rect);
     304    void childrenBoundingRectHelper(QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem);
    243305    void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
    244306                         const QRegion &exposedRegion, bool allItems = false) const;
    245     QRectF effectiveBoundingRect() const;
     307    QRectF effectiveBoundingRect(QGraphicsItem *topMostEffectItem = 0) const;
    246308    QRectF sceneEffectiveBoundingRect() const;
    247309
     
    317379    void removeExtraItemCache();
    318380
     381    void updatePaintedViewBoundingRects(bool updateChildren);
    319382    void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem);
    320383    inline void ensureSceneTransform()
     
    415478    inline void markParentDirty(bool updateBoundingRect = false);
    416479
    417     void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromShow);
     480    void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide);
    418481    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);
    421484    void resetFocusProxy();
    422485    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);
    423492
    424493    inline QTransform transformToParent() const;
     
    428497    inline void sendScenePosChange();
    429498    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();
    430508
    431509    QRectF childrenBoundingRect;
     
    451529    Qt::InputMethodHints imHints;
    452530    QGraphicsItem::PanelModality panelModality;
     531#ifndef QT_NO_GESTURES
    453532    QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
     533#endif
    454534
    455535    // Packed 32 bits
     
    476556    quint32 needSortChildren : 1;
    477557    quint32 allChildrenDirty : 1;
     558    quint32 fullUpdatePending : 1;
     559    quint32 dirtyChildrenBoundingRect : 1;
    478560
    479561    // Packed 32 bits
    480     quint32 fullUpdatePending : 1;
    481     quint32 flags : 17;
    482     quint32 dirtyChildrenBoundingRect : 1;
     562    quint32 flags : 18;
    483563    quint32 paintedViewBoundingRectsNeedRepaint : 1;
    484564    quint32 dirtySceneTransform : 1;
     
    494574    quint32 notifyBoundingRectChanged : 1;
    495575    quint32 notifyInvalidated : 1;
     576    quint32 mouseSetsFocus : 1;
    496577
    497578    // New 32 bits
    498     quint32 mouseSetsFocus : 1;
    499579    quint32 explicitActivate : 1;
    500580    quint32 wantsActive : 1;
     
    505585    quint32 pendingPolish : 1;
    506586    quint32 mayHaveChildWithGraphicsEffect : 1;
     587    quint32 isDeclarativeItem : 1;
     588    quint32 sendParentChangeNotification : 1;
     589    quint32 padding : 22;
    507590
    508591    // Optional stacking order
     
    610693               && !(item->flags() & QGraphicsItem::ItemIsSelectable)
    611694               && item->d_ptr->children.size() == 0;
    612             //|| (item->d_ptr->isObject && qobject_cast<QmlGraphicsImage *>(q_func()));
     695            //|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func()));
    613696    }
    614697
     
    640723/*!
    641724    Returns true if \a item1 is on top of \a item2.
    642     The items dont need to be siblings.
     725    The items don't need to be siblings.
    643726
    644727    \internal
     
    694777/*!
    695778    Returns true if \a item2 is on top of \a item1.
    696     The items dont need to be siblings.
     779    The items don't need to be siblings.
    697780
    698781    \internal
     
    789872        if (parentp->graphicsEffect) {
    790873            if (updateBoundingRect) {
    791                 parentp->notifyInvalidated = 1;
    792874                static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
    793875                                                                ->source->d_func())->invalidateCache();
     876                parentp->notifyInvalidated = 1;
    794877            }
    795             if (parentp->graphicsEffect->isEnabled()) {
     878            if (parentp->scene && parentp->graphicsEffect->isEnabled()) {
    796879                parentp->dirty = 1;
    797880                parentp->fullUpdatePending = 1;
Note: See TracChangeset for help on using the changeset viewer.