Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    154154        localCollisionHack(0),
    155155        inSetPosHelper(0),
    156         needSortChildren(1), // ### can be 0 by default?
     156        needSortChildren(0),
    157157        allChildrenDirty(0),
    158158        fullUpdatePending(0),
     
    179179        updateDueToGraphicsEffect(0),
    180180        scenePosDescendants(0),
     181        pendingPolish(0),
     182        mayHaveChildWithGraphicsEffect(0),
    181183        globalStackingOrder(-1),
    182184        q_ptr(0)
     
    196198    }
    197199
     200    void updateChildWithGraphicsEffectFlagRecursively();
    198201    void updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag,
    199202                            AncestorFlag flag = NoFlag, bool enabled = false, bool root = true);
     203    void updateAncestorFlags();
    200204    void setIsMemberOfGroup(bool enabled);
    201205    void remapItemPos(QEvent *event, QGraphicsItem *item);
     
    224228    int depth() const;
    225229#ifndef QT_NO_GRAPHICSEFFECT
    226     void invalidateGraphicsEffectsRecursively();
     230    enum InvalidateReason {
     231        OpacityChanged
     232    };
     233    void invalidateParentGraphicsEffectsRecursively();
     234    void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason);
    227235#endif //QT_NO_GRAPHICSEFFECT
    228236    void invalidateDepthRecursively();
     
    230238    void addChild(QGraphicsItem *child);
    231239    void removeChild(QGraphicsItem *child);
    232     void setParentItemHelper(QGraphicsItem *parent);
     240    void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant,
     241                             const QVariant *thisPointerVariant);
    233242    void childrenBoundingRectHelper(QTransform *x, QRectF *rect);
    234243    void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform,
     
    350359    }
    351360
     361    inline bool isOpacityNull() const
     362    { return (opacity < qreal(0.001)); }
     363
     364    static inline bool isOpacityNull(qreal opacity)
     365    { return (opacity < qreal(0.001)); }
     366
    352367    inline bool isFullyTransparent() const
    353368    {
    354         if (opacity < 0.001)
     369        if (isOpacityNull())
    355370            return true;
    356371        if (!parent)
    357372            return false;
    358373
    359         return calcEffectiveOpacity() < 0.001;
     374        return isOpacityNull(calcEffectiveOpacity());
    360375    }
    361376
     
    397412        return !visible || (childrenCombineOpacity() && isFullyTransparent());
    398413    }
     414
     415    inline void markParentDirty(bool updateBoundingRect = false);
    399416
    400417    void setFocusHelper(Qt::FocusReason focusReason, bool climb);
     
    485502    quint32 updateDueToGraphicsEffect : 1;
    486503    quint32 scenePosDescendants : 1;
     504    quint32 pendingPolish : 1;
     505    quint32 mayHaveChildWithGraphicsEffect : 1;
    487506
    488507    // Optional stacking order
     
    610629                   QPoint *offset,
    611630                   QGraphicsEffect::PixmapPadMode mode) const;
     631    QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const;
    612632
    613633    QGraphicsItem *item;
     
    721741{
    722742    if (needSortChildren) {
    723         qSort(children.begin(), children.end(), qt_notclosestLeaf);
    724743        needSortChildren = 0;
    725744        sequentialOrdering = 1;
     745        if (children.isEmpty())
     746            return;
     747        qSort(children.begin(), children.end(), qt_notclosestLeaf);
    726748        for (int i = 0; i < children.size(); ++i) {
    727             if (children[i]->d_ptr->siblingIndex != i) {
     749            if (children.at(i)->d_ptr->siblingIndex != i) {
    728750                sequentialOrdering = 0;
    729751                break;
     
    741763}
    742764
     765/*!
     766    \internal
     767*/
     768inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect)
     769{
     770    QGraphicsItemPrivate *parentp = this;
     771    while (parentp->parent) {
     772        parentp = parentp->parent->d_ptr.data();
     773        parentp->dirtyChildren = 1;
     774
     775        if (updateBoundingRect) {
     776            parentp->dirtyChildrenBoundingRect = 1;
     777            // ### Only do this if the parent's effect applies to the entire subtree.
     778            parentp->notifyBoundingRectChanged = 1;
     779        }
     780#ifndef QT_NO_GRAPHICSEFFECT
     781        if (parentp->graphicsEffect) {
     782            if (updateBoundingRect) {
     783                parentp->notifyInvalidated = 1;
     784                static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()
     785                                                                ->source->d_func())->invalidateCache();
     786            }
     787            if (parentp->graphicsEffect->isEnabled()) {
     788                parentp->dirty = 1;
     789                parentp->fullUpdatePending = 1;
     790            }
     791        }
     792#endif
     793    }
     794}
     795
    743796QT_END_NAMESPACE
    744797
Note: See TracChangeset for help on using the changeset viewer.