Changeset 651 for trunk/src/gui/graphicsview
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/graphicsview/qgraph_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsanchorlayout.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsanchorlayout.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsanchorlayout_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsgridlayout.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsgridlayout.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsitem.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 269 269 270 270 /*! 271 \variable QGraphicsItem::Type 272 273 The type value returned by the virtual type() function in standard 274 graphics item classes in Qt. All such standard graphics item 275 classes in Qt are associated with a unique value for Type, 276 e.g. the value returned by QGraphicsPathItem::type() is 2. 277 278 \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 18 279 */ 280 281 /*! 271 282 \variable QGraphicsItem::UserType 272 283 … … 277 288 278 289 \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 1 290 291 \note UserType = 65536 279 292 */ 280 293 … … 799 812 } 800 813 801 foreach (QGraphicsItem *child, children) 802 child->d_ptr->updateAncestorFlag(childFlag, flag, enabled, false); 814 for (int i = 0; i < children.size(); ++i) 815 children.at(i)->d_ptr->updateAncestorFlag(childFlag, flag, enabled, false); 816 } 817 818 void QGraphicsItemPrivate::updateAncestorFlags() 819 { 820 int flags = 0; 821 if (parent) { 822 // Inherit the parent's ancestor flags. 823 QGraphicsItemPrivate *pd = parent->d_ptr.data(); 824 flags = pd->ancestorFlags; 825 826 // Add in flags from the parent. 827 if (pd->filtersDescendantEvents) 828 flags |= AncestorFiltersChildEvents; 829 if (pd->handlesChildEvents) 830 flags |= AncestorHandlesChildEvents; 831 if (pd->flags & QGraphicsItem::ItemClipsChildrenToShape) 832 flags |= AncestorClipsChildren; 833 if (pd->flags & QGraphicsItem::ItemIgnoresTransformations) 834 flags |= AncestorIgnoresTransformations; 835 } 836 837 if (ancestorFlags == flags) 838 return; // No change; stop propagation. 839 ancestorFlags = flags; 840 841 // Propagate to children recursively. 842 for (int i = 0; i < children.size(); ++i) 843 children.at(i)->d_ptr->updateAncestorFlags(); 803 844 } 804 845 … … 985 1026 inDestructor is 1. 986 1027 */ 987 void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) 1028 void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const QVariant *newParentVariant, 1029 const QVariant *thisPointerVariant) 988 1030 { 989 1031 Q_Q(QGraphicsItem); 990 if (newParent == q) {991 qWarning("QGraphicsItem::setParentItem: cannot assign %p as a parent of itself", this);992 return;993 }994 1032 if (newParent == parent) 995 1033 return; 996 1034 997 const QVariant newParentVariant(q->itemChange(QGraphicsItem::ItemParentChange,998 qVariantFromValue<QGraphicsItem *>(newParent)));999 newParent = qVariantValue<QGraphicsItem *>(newParentVariant);1000 if (newParent == parent)1001 return;1002 1003 1035 if (scene) { 1004 1036 // Deliver the change to the index 1005 scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant); 1037 if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex) 1038 scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParent); 1006 1039 1007 1040 // Disable scene pos notifications for old ancestors … … 1021 1054 q_ptr->prepareGeometryChange(); 1022 1055 1023 const QVariant thisPointerVariant(qVariantFromValue<QGraphicsItem *>(q));1024 1056 if (parent) { 1025 1057 // Remove from current parent 1026 1058 parent->d_ptr->removeChild(q); 1027 parent->itemChange(QGraphicsItem::ItemChildRemovedChange, thisPointerVariant); 1059 if (thisPointerVariant) 1060 parent->itemChange(QGraphicsItem::ItemChildRemovedChange, *thisPointerVariant); 1028 1061 } 1029 1062 … … 1043 1076 QGraphicsItem *parentFocusScopeItem = 0; 1044 1077 while (p) { 1045 if (p-> flags()& QGraphicsItem::ItemIsFocusScope) {1078 if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { 1046 1079 // If this item's focus scope's focus scope item points 1047 1080 // to this item or a descendent, then clear it. … … 1056 1089 } 1057 1090 1091 // Update graphics effect optimization flag 1092 if (newParent && (graphicsEffect || mayHaveChildWithGraphicsEffect)) 1093 newParent->d_ptr->updateChildWithGraphicsEffectFlagRecursively(); 1094 1058 1095 // Update focus scope item ptr in new scope. 1059 1096 QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; … … 1064 1101 QGraphicsItem *p = subFocusItem->d_ptr->parent; 1065 1102 while (p) { 1066 if (p-> flags()& QGraphicsItem::ItemIsFocusScope)1103 if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) 1067 1104 ancestorScope = p; 1068 if (p-> isPanel())1105 if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel) 1069 1106 break; 1070 p = p-> parentItem();1107 p = p->d_ptr->parent; 1071 1108 } 1072 1109 if (ancestorScope) … … 1076 1113 QGraphicsItem *p = newParent; 1077 1114 while (p) { 1078 if (p-> flags()& QGraphicsItem::ItemIsFocusScope) {1115 if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { 1079 1116 p->d_ptr->focusScopeItem = newFocusScopeItem; 1080 1117 // Ensure the new item is no longer the subFocusItem. The … … 1090 1127 1091 1128 if ((parent = newParent)) { 1092 bool implicitUpdate = false;1093 1129 if (parent->d_func()->scene && parent->d_func()->scene != scene) { 1094 1130 // Move this item to its new parent's scene 1095 1131 parent->d_func()->scene->addItem(q); 1096 implicitUpdate = true;1097 1132 } else if (!parent->d_func()->scene && scene) { 1098 1133 // Remove this item from its former scene … … 1101 1136 1102 1137 parent->d_ptr->addChild(q); 1103 parent->itemChange(QGraphicsItem::ItemChildAddedChange, thisPointerVariant); 1138 if (thisPointerVariant) 1139 parent->itemChange(QGraphicsItem::ItemChildAddedChange, *thisPointerVariant); 1104 1140 if (scene) { 1105 if (!implicitUpdate)1106 scene->d_func()->markDirty(q_ptr);1107 1108 1141 // Re-enable scene pos notifications for new ancestors 1109 1142 if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges)) … … 1111 1144 } 1112 1145 1146 // Propagate dirty flags to the new parent 1147 markParentDirty(/*updateBoundingRect=*/true); 1148 1113 1149 // Inherit ancestor flags from the new parent. 1114 updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); 1115 updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); 1116 updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape); 1117 updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations); 1150 updateAncestorFlags(); 1118 1151 1119 1152 // Update item visible / enabled. 1120 if (parent-> isVisible()!= visible) {1121 if (!parent-> isVisible()|| !explicitlyHidden)1122 setVisibleHelper(parent-> isVisible(), /* explicit = */ false, /* update = */ !implicitUpdate);1153 if (parent->d_ptr->visible != visible) { 1154 if (!parent->d_ptr->visible || !explicitlyHidden) 1155 setVisibleHelper(parent->d_ptr->visible, /* explicit = */ false, /* update = */ false); 1123 1156 } 1124 1157 if (parent->isEnabled() != enabled) { 1125 if (!parent-> isEnabled()|| !explicitlyDisabled)1126 setEnabledHelper(parent-> isEnabled(), /* explicit = */ false, /* update = */ !implicitUpdate);1158 if (!parent->d_ptr->enabled || !explicitlyDisabled) 1159 setEnabledHelper(parent->d_ptr->enabled, /* explicit = */ false, /* update = */ false); 1127 1160 } 1128 1161 1129 1162 // Auto-activate if visible and the parent is active. 1130 if ( q->isVisible()&& parent->isActive())1163 if (visible && parent->isActive()) 1131 1164 q->setActive(true); 1132 1165 } else { 1133 1166 // Inherit ancestor flags from the new parent. 1134 updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2)); 1135 updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-1)); 1136 updateAncestorFlag(QGraphicsItem::ItemClipsChildrenToShape); 1137 updateAncestorFlag(QGraphicsItem::ItemIgnoresTransformations); 1167 updateAncestorFlags(); 1138 1168 1139 1169 if (!inDestructor) { … … 1143 1173 if (!enabled && !explicitlyDisabled) 1144 1174 setEnabledHelper(true, /* explicit = */ false); 1145 1146 // If the item is being deleted, the whole scene will be updated.1147 if (scene)1148 scene->d_func()->markDirty(q_ptr);1149 1175 } 1150 1176 } … … 1162 1188 1163 1189 // Deliver post-change notification 1164 q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant); 1190 if (newParentVariant) 1191 q->itemChange(QGraphicsItem::ItemParentHasChanged, *newParentVariant); 1165 1192 1166 1193 if (isObject) … … 1351 1378 } else { 1352 1379 d_ptr->resetFocusProxy(); 1353 d_ptr->setParentItemHelper(0);1380 setParentItem(0); 1354 1381 } 1355 1382 … … 1556 1583 \sa parentItem(), childItems() 1557 1584 */ 1558 void QGraphicsItem::setParentItem(QGraphicsItem *parent) 1559 { 1560 d_ptr->setParentItemHelper(parent); 1585 void QGraphicsItem::setParentItem(QGraphicsItem *newParent) 1586 { 1587 if (newParent == this) { 1588 qWarning("QGraphicsItem::setParentItem: cannot assign %p as a parent of itself", this); 1589 return; 1590 } 1591 if (newParent == d_ptr->parent) 1592 return; 1593 1594 const QVariant newParentVariant(itemChange(QGraphicsItem::ItemParentChange, 1595 qVariantFromValue<QGraphicsItem *>(newParent))); 1596 newParent = qVariantValue<QGraphicsItem *>(newParentVariant); 1597 if (newParent == d_ptr->parent) 1598 return; 1599 1600 const QVariant thisPointerVariant(qVariantFromValue<QGraphicsItem *>(this)); 1601 d_ptr->setParentItemHelper(newParent, &newParentVariant, &thisPointerVariant); 1561 1602 } 1562 1603 … … 1608 1649 bool QGraphicsItem::isWindow() const 1609 1650 { 1610 return isWidget()&& (static_cast<const QGraphicsWidget *>(this)->windowType() & Qt::Window);1651 return d_ptr->isWidget && (static_cast<const QGraphicsWidget *>(this)->windowType() & Qt::Window); 1611 1652 } 1612 1653 … … 1645 1686 { 1646 1687 if (enabled) 1647 setFlags( flags() | flag);1688 setFlags(GraphicsItemFlags(d_ptr->flags) | flag); 1648 1689 else 1649 setFlags( flags() & ~flag);1690 setFlags(GraphicsItemFlags(d_ptr->flags) & ~flag); 1650 1691 } 1651 1692 … … 1694 1735 if (quint32(d_ptr->flags) == quint32(flags)) 1695 1736 return; 1696 if (d_ptr->scene )1697 d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, quint32(flags));1737 if (d_ptr->scene && d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex) 1738 d_ptr->scene->d_func()->index->itemChange(this, ItemFlagsChange, &flags); 1698 1739 1699 1740 // Flags that alter the geometry of the item (or its children). … … 1704 1745 1705 1746 // Keep the old flags to compare the diff. 1706 GraphicsItemFlags oldFlags = this->flags();1747 GraphicsItemFlags oldFlags = GraphicsItemFlags(d_ptr->flags); 1707 1748 1708 1749 // Update flags. … … 1733 1774 } 1734 1775 1776 if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) { 1777 // NB! We change the flags directly here, so we must also update d_ptr->flags. 1778 // Note that this has do be done before the ItemStacksBehindParent check 1779 // below; otherwise we will loose the change. 1780 1781 // Update stack-behind. 1782 if (d_ptr->z < qreal(0.0)) 1783 flags |= ItemStacksBehindParent; 1784 else 1785 flags &= ~ItemStacksBehindParent; 1786 d_ptr->flags = flags; 1787 } 1788 1735 1789 if ((flags & ItemStacksBehindParent) != (oldFlags & ItemStacksBehindParent)) { 1790 // NB! This check has to come after the ItemNegativeZStacksBehindParent 1791 // check above. Be careful. 1792 1736 1793 // Ensure child item sorting is up to date when toggling this flag. 1737 1794 if (d_ptr->parent) … … 1747 1804 } 1748 1805 1749 if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) {1750 // Update stack-behind.1751 setFlag(ItemStacksBehindParent, d_ptr->z < qreal(0.0));1752 }1753 1806 1754 1807 if ((d_ptr->panelModality != NonModal) … … 2516 2569 return; 2517 2570 2571 bool wasFullyTransparent = d_ptr->isOpacityNull(); 2518 2572 d_ptr->opacity = newOpacity; 2519 2573 … … 2524 2578 if (d_ptr->scene) { 2525 2579 #ifndef QT_NO_GRAPHICSEFFECT 2526 d_ptr->invalidateGraphicsEffectsRecursively(); 2580 d_ptr->invalidateParentGraphicsEffectsRecursively(); 2581 if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren)) 2582 d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged); 2527 2583 #endif //QT_NO_GRAPHICSEFFECT 2528 2584 d_ptr->scene->d_func()->markDirty(this, QRectF(), 2529 2585 /*invalidateChildren=*/true, 2530 2586 /*force=*/false, 2531 /*ignoreOpacity=*/true); 2587 /*ignoreOpacity=*/d_ptr->isOpacityNull()); 2588 if (wasFullyTransparent) 2589 d_ptr->paintedViewBoundingRectsNeedRepaint = 1; 2532 2590 } 2533 2591 … … 2569 2627 delete d_ptr->graphicsEffect; 2570 2628 d_ptr->graphicsEffect = 0; 2629 } else if (d_ptr->parent) { 2630 d_ptr->parent->d_ptr->updateChildWithGraphicsEffectFlagRecursively(); 2571 2631 } 2572 2632 … … 2581 2641 } 2582 2642 #endif //QT_NO_GRAPHICSEFFECT 2643 2644 void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() 2645 { 2646 #ifndef QT_NO_GRAPHICSEFFECT 2647 QGraphicsItemPrivate *itemPrivate = this; 2648 do { 2649 // parent chain already notified? 2650 if (itemPrivate->mayHaveChildWithGraphicsEffect) 2651 return; 2652 itemPrivate->mayHaveChildWithGraphicsEffect = 1; 2653 } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); 2654 #endif 2655 } 2583 2656 2584 2657 /*! … … 2998 3071 bool QGraphicsItem::hasFocus() const 2999 3072 { 3073 if (!d_ptr->scene || !d_ptr->scene->isActive()) 3074 return false; 3075 3000 3076 if (d_ptr->focusProxy) 3001 3077 return d_ptr->focusProxy->hasFocus(); 3002 return isActive() && (d_ptr->scene && d_ptr->scene->focusItem() == this); 3078 3079 if (d_ptr->scene->d_func()->focusItem != this) 3080 return false; 3081 3082 return panel() == d_ptr->scene->d_func()->activePanel; 3003 3083 } 3004 3084 … … 4258 4338 return; 4259 4339 4260 if (d_ptr->scene ) {4340 if (d_ptr->scene && d_ptr->scene->d_func()->indexMethod != QGraphicsScene::NoIndex) { 4261 4341 // Z Value has changed, we have to notify the index. 4262 d_ptr->scene->d_func()->index->itemChange(this, ItemZValueChange, newZVariant);4342 d_ptr->scene->d_func()->index->itemChange(this, ItemZValueChange, &newZ); 4263 4343 } 4264 4344 … … 5027 5107 */ 5028 5108 #ifndef QT_NO_GRAPHICSEFFECT 5029 void QGraphicsItemPrivate::invalidate GraphicsEffectsRecursively()5109 void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() 5030 5110 { 5031 5111 QGraphicsItemPrivate *itemPrivate = this; … … 5038 5118 } 5039 5119 } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); 5120 } 5121 5122 void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::InvalidateReason reason) 5123 { 5124 if (!mayHaveChildWithGraphicsEffect) 5125 return; 5126 5127 for (int i = 0; i < children.size(); ++i) { 5128 QGraphicsItemPrivate *childPrivate = children.at(i)->d_ptr.data(); 5129 if (reason == OpacityChanged && (childPrivate->flags & QGraphicsItem::ItemIgnoresParentOpacity)) 5130 continue; 5131 if (childPrivate->graphicsEffect) { 5132 childPrivate->notifyInvalidated = 1; 5133 static_cast<QGraphicsItemEffectSourcePrivate *>(childPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); 5134 } 5135 5136 childPrivate->invalidateChildGraphicsEffectsRecursively(reason); 5137 } 5040 5138 } 5041 5139 #endif //QT_NO_GRAPHICSEFFECT … … 5283 5381 // Make sure we notify effects about invalidated source. 5284 5382 #ifndef QT_NO_GRAPHICSEFFECT 5285 d_ptr->invalidate GraphicsEffectsRecursively();5383 d_ptr->invalidateParentGraphicsEffectsRecursively(); 5286 5384 #endif //QT_NO_GRAPHICSEFFECT 5287 5385 … … 7176 7274 } 7177 7275 7178 QGraphicsItem *parent = this; 7179 while ((parent = parent->d_ptr->parent)) { 7180 QGraphicsItemPrivate *parentp = parent->d_ptr.data(); 7181 parentp->dirtyChildrenBoundingRect = 1; 7182 // ### Only do this if the parent's effect applies to the entire subtree. 7183 parentp->notifyBoundingRectChanged = 1; 7184 #ifndef QT_NO_GRAPHICSEFFECT 7185 if (parentp->scene && parentp->graphicsEffect) { 7186 parentp->notifyInvalidated = 1; 7187 static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()->source->d_func())->invalidateCache(); 7188 } 7189 #endif 7190 } 7276 d_ptr->markParentDirty(/*updateBoundingRect=*/true); 7191 7277 } 7192 7278 … … 10716 10802 } 10717 10803 10718 QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, 10719 QGraphicsEffect::PixmapPadMode mode) const 10720 { 10721 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); 10722 if (!info && deviceCoordinates) { 10723 // Device coordinates without info not yet supported. 10724 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); 10725 return QPixmap(); 10726 } 10727 if (!item->d_ptr->scene) 10728 return QPixmap(); 10729 QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); 10730 10731 const QRectF sourceRect = boundingRect(system); 10804 QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded) const 10805 { 10732 10806 QRectF effectRectF; 10733 10807 10734 bool unpadded = false; 10808 if (unpadded) 10809 *unpadded = false; 10810 10735 10811 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { 10736 10812 if (info) { 10737 10813 effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates)); 10738 unpadded = (effectRectF.size() == sourceRect.size()); 10814 if (unpadded) 10815 *unpadded = (effectRectF.size() == sourceRect.size()); 10739 10816 if (info && system == Qt::LogicalCoordinates) 10740 10817 effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF); … … 10748 10825 } else { 10749 10826 effectRectF = sourceRect; 10750 unpadded = true; 10751 } 10752 10753 QRect effectRect = effectRectF.toAlignedRect(); 10827 if (unpadded) 10828 *unpadded = true; 10829 } 10830 10831 return effectRectF.toAlignedRect(); 10832 } 10833 10834 QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, 10835 QGraphicsEffect::PixmapPadMode mode) const 10836 { 10837 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); 10838 if (!info && deviceCoordinates) { 10839 // Device coordinates without info not yet supported. 10840 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); 10841 return QPixmap(); 10842 } 10843 if (!item->d_ptr->scene) 10844 return QPixmap(); 10845 QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func(); 10846 10847 bool unpadded; 10848 const QRectF sourceRect = boundingRect(system); 10849 QRect effectRect = paddedEffectRect(system, mode, sourceRect, &unpadded); 10754 10850 10755 10851 if (offset) -
trunk/src/gui/graphicsview/qgraphicsitem.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsitem_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 154 154 localCollisionHack(0), 155 155 inSetPosHelper(0), 156 needSortChildren( 1), // ### can be 0 by default?156 needSortChildren(0), 157 157 allChildrenDirty(0), 158 158 fullUpdatePending(0), … … 179 179 updateDueToGraphicsEffect(0), 180 180 scenePosDescendants(0), 181 pendingPolish(0), 182 mayHaveChildWithGraphicsEffect(0), 181 183 globalStackingOrder(-1), 182 184 q_ptr(0) … … 196 198 } 197 199 200 void updateChildWithGraphicsEffectFlagRecursively(); 198 201 void updateAncestorFlag(QGraphicsItem::GraphicsItemFlag childFlag, 199 202 AncestorFlag flag = NoFlag, bool enabled = false, bool root = true); 203 void updateAncestorFlags(); 200 204 void setIsMemberOfGroup(bool enabled); 201 205 void remapItemPos(QEvent *event, QGraphicsItem *item); … … 224 228 int depth() const; 225 229 #ifndef QT_NO_GRAPHICSEFFECT 226 void invalidateGraphicsEffectsRecursively(); 230 enum InvalidateReason { 231 OpacityChanged 232 }; 233 void invalidateParentGraphicsEffectsRecursively(); 234 void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason); 227 235 #endif //QT_NO_GRAPHICSEFFECT 228 236 void invalidateDepthRecursively(); … … 230 238 void addChild(QGraphicsItem *child); 231 239 void removeChild(QGraphicsItem *child); 232 void setParentItemHelper(QGraphicsItem *parent); 240 void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, 241 const QVariant *thisPointerVariant); 233 242 void childrenBoundingRectHelper(QTransform *x, QRectF *rect); 234 243 void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, … … 350 359 } 351 360 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 352 367 inline bool isFullyTransparent() const 353 368 { 354 if ( opacity < 0.001)369 if (isOpacityNull()) 355 370 return true; 356 371 if (!parent) 357 372 return false; 358 373 359 return calcEffectiveOpacity() < 0.001;374 return isOpacityNull(calcEffectiveOpacity()); 360 375 } 361 376 … … 397 412 return !visible || (childrenCombineOpacity() && isFullyTransparent()); 398 413 } 414 415 inline void markParentDirty(bool updateBoundingRect = false); 399 416 400 417 void setFocusHelper(Qt::FocusReason focusReason, bool climb); … … 485 502 quint32 updateDueToGraphicsEffect : 1; 486 503 quint32 scenePosDescendants : 1; 504 quint32 pendingPolish : 1; 505 quint32 mayHaveChildWithGraphicsEffect : 1; 487 506 488 507 // Optional stacking order … … 610 629 QPoint *offset, 611 630 QGraphicsEffect::PixmapPadMode mode) const; 631 QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const; 612 632 613 633 QGraphicsItem *item; … … 721 741 { 722 742 if (needSortChildren) { 723 qSort(children.begin(), children.end(), qt_notclosestLeaf);724 743 needSortChildren = 0; 725 744 sequentialOrdering = 1; 745 if (children.isEmpty()) 746 return; 747 qSort(children.begin(), children.end(), qt_notclosestLeaf); 726 748 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) { 728 750 sequentialOrdering = 0; 729 751 break; … … 741 763 } 742 764 765 /*! 766 \internal 767 */ 768 inline 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 743 796 QT_END_NAMESPACE 744 797 -
trunk/src/gui/graphicsview/qgraphicsitemanimation.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsitemanimation.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayout.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayout.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayout_p.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayout_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayoutitem.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayoutitem.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslayoutitem_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicslinearlayout.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsproxywidget.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsproxywidget.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsproxywidget_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsscene.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 252 252 #include <private/qgraphicseffect_p.h> 253 253 #include <private/qgesturemanager_p.h> 254 #include <private/qpathclipper_p.h> 254 255 255 256 // #define GESTURE_DEBUG … … 293 294 selectionChanging(0), 294 295 needSortTopLevelItems(true), 295 unpolishedItemsModified(true),296 296 holesInTopLevelSiblingIndex(false), 297 297 topLevelSequentialOrdering(true), … … 374 374 } 375 375 } else { 376 updateAll = false; 376 if (views.isEmpty()) { 377 updateAll = false; 378 return; 379 } 377 380 for (int i = 0; i < views.size(); ++i) 378 381 views.at(i)->d_func()->processPendingUpdates(); … … 430 433 void QGraphicsScenePrivate::_q_polishItems() 431 434 { 432 QSet<QGraphicsItem *>::Iterator it = unpolishedItems.begin(); 435 if (unpolishedItems.isEmpty()) 436 return; 437 433 438 const QVariant booleanTrueVariant(true); 434 while (!unpolishedItems.isEmpty()) { 435 QGraphicsItem *item = *it; 436 it = unpolishedItems.erase(it); 437 unpolishedItemsModified = false; 438 if (!item->d_ptr->explicitlyHidden) { 439 QGraphicsItem *item = 0; 440 QGraphicsItemPrivate *itemd = 0; 441 const int oldUnpolishedCount = unpolishedItems.count(); 442 443 for (int i = 0; i < oldUnpolishedCount; ++i) { 444 item = unpolishedItems.at(i); 445 if (!item) 446 continue; 447 itemd = item->d_ptr.data(); 448 itemd->pendingPolish = false; 449 if (!itemd->explicitlyHidden) { 439 450 item->itemChange(QGraphicsItem::ItemVisibleChange, booleanTrueVariant); 440 451 item->itemChange(QGraphicsItem::ItemVisibleHasChanged, booleanTrueVariant); 441 452 } 442 if (item ->isWidget()) {453 if (itemd->isWidget) { 443 454 QEvent event(QEvent::Polish); 444 455 QApplication::sendEvent((QGraphicsWidget *)item, &event); 445 456 } 446 if (unpolishedItemsModified) 447 it = unpolishedItems.begin(); 457 } 458 459 if (unpolishedItems.count() == oldUnpolishedCount) { 460 // No new items were added to the vector. 461 unpolishedItems.clear(); 462 } else { 463 // New items were appended; keep them and remove the old ones. 464 unpolishedItems.remove(0, oldUnpolishedCount); 465 unpolishedItems.squeeze(); 466 QMetaObject::invokeMethod(q_ptr, "_q_polishItems", Qt::QueuedConnection); 448 467 } 449 468 } … … 600 619 Q_ASSERT_X(parentItem->scene() == q, "QGraphicsScene::removeItem", 601 620 "Parent item's scene is different from this item's scene"); 602 item-> d_ptr->setParentItemHelper(0);621 item->setParentItem(0); 603 622 } 604 623 } else { … … 639 658 hoverItems.removeAll(item); 640 659 cachedItemsUnderMouse.removeAll(item); 641 unpolishedItems.remove(item); 642 unpolishedItemsModified = true; 660 if (item->d_ptr->pendingPolish) { 661 const int unpolishedIndex = unpolishedItems.indexOf(item); 662 if (unpolishedIndex != -1) 663 unpolishedItems[unpolishedIndex] = 0; 664 item->d_ptr->pendingPolish = false; 665 } 643 666 resetDirtyItem(item); 644 667 … … 1937 1960 1938 1961 This convenience function is equivalent to calling items(QRectF(\a x, \a y, \a w, \a h), \a mode). 1939 1962 1940 1963 This function is deprecated and returns incorrect results if the scene 1941 1964 contains items that ignore transformations. Use the overload that takes … … 2483 2506 return; 2484 2507 } 2485 if (item-> scene()== this) {2508 if (item->d_ptr->scene == this) { 2486 2509 qWarning("QGraphicsScene::addItem: item has already been added to this scene"); 2487 2510 return; 2488 2511 } 2489 2512 // Remove this item from its existing scene 2490 if (QGraphicsScene *oldScene = item-> scene())2513 if (QGraphicsScene *oldScene = item->d_ptr->scene) 2491 2514 oldScene->removeItem(item); 2492 2515 … … 2497 2520 QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(newSceneVariant); 2498 2521 if (targetScene != this) { 2499 if (targetScene && item-> scene()!= targetScene)2522 if (targetScene && item->d_ptr->scene != targetScene) 2500 2523 targetScene->addItem(item); 2501 2524 return; 2502 2525 } 2503 2526 2527 if (d->unpolishedItems.isEmpty()) 2528 QMetaObject::invokeMethod(this, "_q_polishItems", Qt::QueuedConnection); 2529 d->unpolishedItems.append(item); 2530 item->d_ptr->pendingPolish = true; 2531 2504 2532 // Detach this item from its parent if the parent's scene is different 2505 2533 // from this scene. 2506 if (QGraphicsItem *itemParent = item-> parentItem()) {2507 if (itemParent-> scene()!= this)2534 if (QGraphicsItem *itemParent = item->d_ptr->parent) { 2535 if (itemParent->d_ptr->scene != this) 2508 2536 item->setParentItem(0); 2509 2537 } … … 2535 2563 } 2536 2564 #ifndef QT_NO_CURSOR 2537 if (d->allItemsUseDefaultCursor && item-> hasCursor()) {2565 if (d->allItemsUseDefaultCursor && item->d_ptr->hasCursor) { 2538 2566 d->allItemsUseDefaultCursor = false; 2539 2567 if (d->allItemsIgnoreHoverEvents) // already enabled otherwise … … 2543 2571 2544 2572 // Enable touch events if the item accepts touch events. 2545 if (d->allItemsIgnoreTouchEvents && item-> acceptTouchEvents()) {2573 if (d->allItemsIgnoreTouchEvents && item->d_ptr->acceptTouchEvents) { 2546 2574 d->allItemsIgnoreTouchEvents = false; 2547 2575 d->enableTouchEventsOnViews(); … … 2576 2604 2577 2605 // Add all children recursively 2578 foreach (QGraphicsItem *child, item->children()) 2579 addItem(child); 2606 item->d_ptr->ensureSortedChildren(); 2607 for (int i = 0; i < item->d_ptr->children.size(); ++i) 2608 addItem(item->d_ptr->children.at(i)); 2580 2609 2581 2610 // Resolve font and palette. … … 2583 2612 item->d_ptr->resolvePalette(d->palette.resolve()); 2584 2613 2585 if (d->unpolishedItems.isEmpty())2586 QMetaObject::invokeMethod(this, "_q_polishItems", Qt::QueuedConnection);2587 d->unpolishedItems.insert(item);2588 d->unpolishedItemsModified = true;2589 2614 2590 2615 // Reenable selectionChanged() for individual items … … 2620 2645 } 2621 2646 2622 if (item-> flags()& QGraphicsItem::ItemSendsScenePositionChanges)2647 if (item->d_ptr->flags & QGraphicsItem::ItemSendsScenePositionChanges) 2623 2648 d->registerScenePosItem(item); 2624 2649 … … 3767 3792 bool QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(const QGraphicsItem *item) const 3768 3793 { 3769 return ( !item->isBlockedByModalPanel() &&3770 (item->acceptHoverEvents()3771 || (item->isWidget()3772 && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())));3794 return (item->d_ptr->acceptsHover 3795 || (item->d_ptr->isWidget 3796 && static_cast<const QGraphicsWidget *>(item)->d_func()->hasDecoration())) 3797 && !item->isBlockedByModalPanel(); 3773 3798 } 3774 3799 … … 4583 4608 _q_polishItems(); 4584 4609 4610 updateAll = false; 4585 4611 QRectF exposedSceneRect; 4586 4612 if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) { … … 4610 4636 4611 4637 const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); 4612 const bool itemIsFullyTransparent = (opacity < 0.0001);4638 const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); 4613 4639 if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) 4614 4640 return; … … 4687 4713 && sourced->lastEffectTransform != painter->worldTransform()) 4688 4714 { 4715 bool unclipped = false; 4716 if (sourced->lastEffectTransform.type() <= QTransform::TxTranslate 4717 && painter->worldTransform().type() <= QTransform::TxTranslate) 4718 { 4719 QRectF itemRect = item->boundingRect(); 4720 if (!item->d_ptr->children.isEmpty()) 4721 itemRect |= item->childrenBoundingRect(); 4722 4723 QRectF oldSourceRect = sourced->lastEffectTransform.mapRect(itemRect); 4724 QRectF newSourceRect = painter->worldTransform().mapRect(itemRect); 4725 4726 QRect oldEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), oldSourceRect); 4727 QRect newEffectRect = sourced->paddedEffectRect(sourced->currentCachedSystem(), sourced->currentCachedMode(), newSourceRect); 4728 4729 QRect deviceRect(0, 0, painter->device()->width(), painter->device()->height()); 4730 if (deviceRect.contains(oldEffectRect) && deviceRect.contains(newEffectRect)) { 4731 sourced->setCachedOffset(newEffectRect.topLeft()); 4732 unclipped = true; 4733 } 4734 } 4735 4689 4736 sourced->lastEffectTransform = painter->worldTransform(); 4690 sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); 4737 4738 if (!unclipped) 4739 sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged); 4691 4740 } 4692 4741 … … 4707 4756 bool wasDirtyParentSceneTransform, bool drawItem) 4708 4757 { 4709 const bool itemIsFullyTransparent = (opacity < 0.0001);4758 const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); 4710 4759 const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); 4711 4760 const bool itemHasChildren = !item->d_ptr->children.isEmpty(); … … 4722 4771 else 4723 4772 painter->setWorldTransform(*transformPtr); 4724 painter->setClipPath(item->shape(), Qt::IntersectClip); 4773 QRectF clipRect; 4774 const QPainterPath clipPath(item->shape()); 4775 if (QPathClipper::pathToRect(clipPath, &clipRect)) 4776 painter->setClipRect(clipRect, Qt::IntersectClip); 4777 else 4778 painter->setClipPath(clipPath, Qt::IntersectClip); 4725 4779 } 4726 4780 … … 4758 4812 } 4759 4813 4760 if (itemClipsToShape) 4761 painter->setClipPath(item->shape(), Qt::IntersectClip); 4814 if (itemClipsToShape) { 4815 QRectF clipRect; 4816 const QPainterPath clipPath(item->shape()); 4817 if (QPathClipper::pathToRect(clipPath, &clipRect)) 4818 painter->setClipRect(clipRect, Qt::IntersectClip); 4819 else 4820 painter->setClipPath(clipPath, Qt::IntersectClip); 4821 } 4762 4822 painter->setOpacity(opacity); 4763 4823 … … 4860 4920 item->d_ptr->ignoreOpacity = 1; 4861 4921 4862 QGraphicsItem *p = item->d_ptr->parent; 4863 while (p) { 4864 p->d_ptr->dirtyChildren = 1; 4865 #ifndef QT_NO_GRAPHICSEFFECT 4866 if (p->d_ptr->graphicsEffect && p->d_ptr->graphicsEffect->isEnabled()) { 4867 p->d_ptr->dirty = 1; 4868 p->d_ptr->fullUpdatePending = 1; 4869 } 4870 #endif //QT_NO_GRAPHICSEFFECT 4871 p = p->d_ptr->parent; 4872 } 4922 item->d_ptr->markParentDirty(); 4873 4923 } 4874 4924 … … 4945 4995 4946 4996 const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); 4947 const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity && opacity < 0.0001; 4997 const bool itemIsFullyTransparent = !item->d_ptr->ignoreOpacity 4998 && QGraphicsItemPrivate::isOpacityNull(opacity); 4948 4999 if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) { 4949 5000 resetDirtyItem(item, /*recursive=*/itemHasChildren); … … 5118 5169 d->_q_polishItems(); 5119 5170 5171 d->updateAll = false; 5120 5172 QTransform viewTransform = painter->worldTransform(); 5121 5173 Q_UNUSED(options); -
trunk/src/gui/graphicsview/qgraphicsscene.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsscene_bsp.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsscene_bsp_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsscene_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 109 109 int selectionChanging; 110 110 QSet<QGraphicsItem *> selectedItems; 111 Q Set<QGraphicsItem *> unpolishedItems;111 QVector<QGraphicsItem *> unpolishedItems; 112 112 QList<QGraphicsItem *> topLevelItems; 113 113 bool needSortTopLevelItems; 114 bool unpolishedItemsModified;115 114 bool holesInTopLevelSiblingIndex; 116 115 bool topLevelSequentialOrdering; -
trunk/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 636 636 update the BSP tree if necessary. 637 637 */ 638 void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value)638 void QGraphicsSceneBspTreeIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) 639 639 { 640 640 Q_D(QGraphicsSceneBspTreeIndex); … … 642 642 case QGraphicsItem::ItemFlagsChange: { 643 643 // Handle ItemIgnoresTransformations 644 QGraphicsItem::GraphicsItemFlags newFlags = *static_cast<const QGraphicsItem::GraphicsItemFlags *>(value); 644 645 bool ignoredTransform = item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations; 645 bool willIgnoreTransform = value.toUInt()& QGraphicsItem::ItemIgnoresTransformations;646 bool willIgnoreTransform = newFlags & QGraphicsItem::ItemIgnoresTransformations; 646 647 bool clipsChildren = item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape; 647 bool willClipChildren = value.toUInt()& QGraphicsItem::ItemClipsChildrenToShape;648 bool willClipChildren = newFlags & QGraphicsItem::ItemClipsChildrenToShape; 648 649 if ((ignoredTransform != willIgnoreTransform) || (clipsChildren != willClipChildren)) { 649 650 QGraphicsItem *thatItem = const_cast<QGraphicsItem *>(item); … … 662 663 d->invalidateSortCache(); 663 664 // Handle ItemIgnoresTransformations 664 QGraphicsItem *newParent = qVariantValue<QGraphicsItem *>(value);665 const QGraphicsItem *newParent = static_cast<const QGraphicsItem *>(value); 665 666 bool ignoredTransform = item->d_ptr->itemIsUntransformable(); 666 667 bool willIgnoreTransform = (item->d_ptr->flags & QGraphicsItem::ItemIgnoresTransformations) … … 683 684 break; 684 685 } 685 return QGraphicsSceneIndex::itemChange(item, change, value);686 686 } 687 687 /*! -
trunk/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 98 98 void prepareBoundingRectChange(const QGraphicsItem *item); 99 99 100 void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value);100 void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value); 101 101 102 102 private : -
trunk/src/gui/graphicsview/qgraphicssceneevent.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicssceneevent.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicssceneindex.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 280 280 281 281 const qreal opacity = item->d_ptr->combineOpacityFromParent(parentOpacity); 282 const bool itemIsFullyTransparent = (opacity < 0.0001);282 const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); 283 283 const bool itemHasChildren = !item->d_ptr->children.isEmpty(); 284 284 if (itemIsFullyTransparent && (!itemHasChildren || item->d_ptr->childrenCombineOpacity())) … … 555 555 /*! 556 556 \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::DescendingOrder) const 557 557 558 558 This pure virtual function all items in the index and sort them using 559 559 \a order. … … 625 625 \sa QGraphicsItem::GraphicsItemChange 626 626 */ 627 void QGraphicsSceneIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const QVariant &value)627 void QGraphicsSceneIndex::itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) 628 628 { 629 629 Q_UNUSED(item); -
trunk/src/gui/graphicsview/qgraphicssceneindex_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 111 111 virtual void deleteItem(QGraphicsItem *item); 112 112 113 virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const QVariant &value);113 virtual void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange, const void *const value); 114 114 virtual void prepareBoundingRectChange(const QGraphicsItem *item); 115 115 -
trunk/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsscenelinearindex_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicstransform.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicstransform.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicstransform_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsview.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 2749 2749 } 2750 2750 } 2751 d->scene->d_func()->updateAll = false;2752 2751 } 2753 2752 break; -
trunk/src/gui/graphicsview/qgraphicsview.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicsview_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicswidget.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicswidget.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicswidget_p.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgraphicswidget_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qgridlayoutengine.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 183 183 184 184 for (int j = 0; j < NSizes; ++j) { 185 qreal extra = compare( totalBox, box, j);185 qreal extra = compare(box, totalBox, j); 186 186 if (extra > 0.0) { 187 calculateGeometries(start, end, totalBox.q_sizes(j), dummy.data(), newSizes.data(),187 calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), 188 188 0, totalBox); 189 189 -
trunk/src/gui/graphicsview/qgridlayoutengine_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qsimplex_p.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/graphicsview/qsimplex_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com)
Note:
See TracChangeset
for help on using the changeset viewer.