src/gui/graphicsview/qgraphicsscene_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    76 
    76 
    77 class QGraphicsSceneIndex;
    77 class QGraphicsSceneIndex;
    78 class QGraphicsView;
    78 class QGraphicsView;
    79 class QGraphicsWidget;
    79 class QGraphicsWidget;
    80 
    80 
    81 class QGraphicsScenePrivate : public QObjectPrivate
    81 class Q_AUTOTEST_EXPORT QGraphicsScenePrivate : public QObjectPrivate
    82 {
    82 {
    83     Q_DECLARE_PUBLIC(QGraphicsScene)
    83     Q_DECLARE_PUBLIC(QGraphicsScene)
    84 public:
    84 public:
    85     QGraphicsScenePrivate();
    85     QGraphicsScenePrivate();
    86     void init();
    86     void init();
   119     void unregisterTopLevelItem(QGraphicsItem *item);
   119     void unregisterTopLevelItem(QGraphicsItem *item);
   120     void _q_updateLater();
   120     void _q_updateLater();
   121     void _q_polishItems();
   121     void _q_polishItems();
   122 
   122 
   123     void _q_processDirtyItems();
   123     void _q_processDirtyItems();
       
   124 
       
   125     QSet<QGraphicsItem *> scenePosItems;
       
   126     bool scenePosDescendantsUpdatePending;
       
   127     void setScenePosItemEnabled(QGraphicsItem *item, bool enabled);
       
   128     void registerScenePosItem(QGraphicsItem *item);
       
   129     void unregisterScenePosItem(QGraphicsItem *item);
       
   130     void _q_updateScenePosDescendants();
   124 
   131 
   125     void removeItemHelper(QGraphicsItem *item);
   132     void removeItemHelper(QGraphicsItem *item);
   126 
   133 
   127     QBrush backgroundBrush;
   134     QBrush backgroundBrush;
   128     QBrush foregroundBrush;
   135     QBrush foregroundBrush;
   213                               const QTransform *const effectTransform = 0);
   220                               const QTransform *const effectTransform = 0);
   214     void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const,
   221     void draw(QGraphicsItem *, QPainter *, const QTransform *const, const QTransform *const,
   215               QRegion *, QWidget *, qreal, const QTransform *const, bool, bool);
   222               QRegion *, QWidget *, qreal, const QTransform *const, bool, bool);
   216 
   223 
   217     void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false,
   224     void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false,
   218                    bool maybeDirtyClipPath = false, bool force = false, bool ignoreOpacity = false,
   225                    bool force = false, bool ignoreOpacity = false, bool removingItemFromScene = false);
   219                    bool removingItemFromScene = false);
       
   220     void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false,
   226     void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false,
   221                                     qreal parentOpacity = qreal(1.0));
   227                                     qreal parentOpacity = qreal(1.0));
   222 
   228 
   223     inline void resetDirtyItem(QGraphicsItem *item, bool recursive = false)
   229     inline void resetDirtyItem(QGraphicsItem *item, bool recursive = false)
   224     {
   230     {
   232         item->d_ptr->needsRepaint = QRectF();
   238         item->d_ptr->needsRepaint = QRectF();
   233         item->d_ptr->allChildrenDirty = 0;
   239         item->d_ptr->allChildrenDirty = 0;
   234         item->d_ptr->fullUpdatePending = 0;
   240         item->d_ptr->fullUpdatePending = 0;
   235         item->d_ptr->ignoreVisible = 0;
   241         item->d_ptr->ignoreVisible = 0;
   236         item->d_ptr->ignoreOpacity = 0;
   242         item->d_ptr->ignoreOpacity = 0;
       
   243 #ifndef QT_NO_GRAPHICSEFFECT
   237         QGraphicsEffect::ChangeFlags flags;
   244         QGraphicsEffect::ChangeFlags flags;
   238         if (item->d_ptr->notifyBoundingRectChanged) {
   245         if (item->d_ptr->notifyBoundingRectChanged) {
   239             flags |= QGraphicsEffect::SourceBoundingRectChanged;
   246             flags |= QGraphicsEffect::SourceBoundingRectChanged;
   240             item->d_ptr->notifyBoundingRectChanged = 0;
   247             item->d_ptr->notifyBoundingRectChanged = 0;
   241         }
   248         }
   242         if (item->d_ptr->notifyInvalidated) {
   249         if (item->d_ptr->notifyInvalidated) {
   243             flags |= QGraphicsEffect::SourceInvalidated;
   250             flags |= QGraphicsEffect::SourceInvalidated;
   244             item->d_ptr->notifyInvalidated = 0;
   251             item->d_ptr->notifyInvalidated = 0;
   245         }
   252         }
       
   253 #endif //QT_NO_GRAPHICSEFFECT
   246         if (recursive) {
   254         if (recursive) {
   247             for (int i = 0; i < item->d_ptr->children.size(); ++i)
   255             for (int i = 0; i < item->d_ptr->children.size(); ++i)
   248                 resetDirtyItem(item->d_ptr->children.at(i), recursive);
   256                 resetDirtyItem(item->d_ptr->children.at(i), recursive);
   249         }
   257         }
       
   258 #ifndef QT_NO_GRAPHICSEFFECT
   250         if (flags && item->d_ptr->graphicsEffect)
   259         if (flags && item->d_ptr->graphicsEffect)
   251             item->d_ptr->graphicsEffect->sourceChanged(flags);
   260             item->d_ptr->graphicsEffect->sourceChanged(flags);
       
   261 #endif //QT_NO_GRAPHICSEFFECT
   252     }
   262     }
   253 
   263 
   254     inline void ensureSortedTopLevelItems()
   264     inline void ensureSortedTopLevelItems()
   255     {
   265     {
   256         if (needSortTopLevelItems) {
   266         if (needSortTopLevelItems) {
   257             qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
   267             qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
       
   268             topLevelSequentialOrdering = false;
   258             needSortTopLevelItems = false;
   269             needSortTopLevelItems = false;
   259         }
   270         }
   260     }
   271     }
   261 
   272 
   262     void ensureSequentialTopLevelSiblingIndexes();
   273     void ensureSequentialTopLevelSiblingIndexes();
   286     void gestureEventHandler(QGestureEvent *event);
   297     void gestureEventHandler(QGestureEvent *event);
   287     void getGestureTargets(const QSet<QGesture *> &gestures, QWidget *viewport,
   298     void getGestureTargets(const QSet<QGesture *> &gestures, QWidget *viewport,
   288                            QMap<Qt::GestureType, QGesture *> *conflictedGestures,
   299                            QMap<Qt::GestureType, QGesture *> *conflictedGestures,
   289                            QList<QList<QGraphicsObject *> > *conflictedItems,
   300                            QList<QList<QGraphicsObject *> > *conflictedItems,
   290                            QHash<QGesture *, QGraphicsObject *> *normalGestures);
   301                            QHash<QGesture *, QGraphicsObject *> *normalGestures);
       
   302     void cancelGesturesForChildren(QGesture *original, QWidget *viewport);
   291 
   303 
   292     void updateInputMethodSensitivityInViews();
   304     void updateInputMethodSensitivityInViews();
   293 
   305 
   294     QList<QGraphicsItem *> modalPanels;
   306     QList<QGraphicsItem *> modalPanels;
   295     void enterModal(QGraphicsItem *item,
   307     void enterModal(QGraphicsItem *item,