summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 7c0f836156..6f1eb4b346 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1250,7 +1250,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (isWidget)
static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent &&
- newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0,
+ newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : nullptr,
scene);
if (scene) {
// Deliver the change to the index
@@ -1293,7 +1293,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Ensure any last parent focus scope does not point to this item or any of
// its descendents.
QGraphicsItem *p = parent;
- QGraphicsItem *parentFocusScopeItem = 0;
+ QGraphicsItem *parentFocusScopeItem = nullptr;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
// If this item's focus scope's focus scope item points
@@ -1301,7 +1301,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
QGraphicsItem *fsi = p->d_ptr->focusScopeItem;
if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) {
parentFocusScopeItem = fsi;
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
fsi->d_ptr->focusScopeItemChange(false);
}
break;
@@ -1321,7 +1321,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
if (subFocusItem && subFocusItem != q_ptr) {
// Find the subFocusItem's topmost focus scope within the new parent's focusscope
- QGraphicsItem *ancestorScope = 0;
+ QGraphicsItem *ancestorScope = nullptr;
QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
while (p2 && p2 != p) {
if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
@@ -1587,7 +1587,7 @@ QGraphicsItem::~QGraphicsItem()
if (QAbstractDeclarativeData::destroyed)
QAbstractDeclarativeData::destroyed(p->declarativeData, o);
}
- p->declarativeData = 0;
+ p->declarativeData = nullptr;
p->wasDeleted = false;
}
}
@@ -1607,14 +1607,14 @@ QGraphicsItem::~QGraphicsItem()
#endif
clearFocus();
- setFocusProxy(0);
+ setFocusProxy(nullptr);
// Update focus scope item ptr.
QGraphicsItem *p = d_ptr->parent;
while (p) {
if (p->flags() & ItemIsFocusScope) {
if (p->d_ptr->focusScopeItem == this)
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
break;
}
p = p->d_ptr->parent;
@@ -1630,7 +1630,7 @@ QGraphicsItem::~QGraphicsItem()
d_ptr->scene->d_func()->removeItemHelper(this);
} else {
d_ptr->resetFocusProxy();
- setParentItem(0);
+ setParentItem(nullptr);
}
#if QT_CONFIG(graphicseffect)
@@ -1639,7 +1639,7 @@ QGraphicsItem::~QGraphicsItem()
if (d_ptr->transformData) {
for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
- static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = 0;
+ static_cast<QGraphicsTransformPrivate *>(t->d_ptr.data())->item = nullptr;
delete t;
}
}
@@ -1751,7 +1751,7 @@ QGraphicsWidget *QGraphicsItem::parentWidget() const
QGraphicsItem *p = parentItem();
while (p && !p->isWidget())
p = p->parentItem();
- return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : 0;
+ return (p && p->isWidget()) ? static_cast<QGraphicsWidget *>(p) : nullptr;
}
/*!
@@ -1811,7 +1811,7 @@ QGraphicsItem *QGraphicsItem::panel() const
*/
QGraphicsObject *QGraphicsItem::toGraphicsObject()
{
- return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0;
+ return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : nullptr;
}
/*!
@@ -1822,7 +1822,7 @@ QGraphicsObject *QGraphicsItem::toGraphicsObject()
*/
const QGraphicsObject *QGraphicsItem::toGraphicsObject() const
{
- return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : 0;
+ return d_ptr->isObject ? static_cast<const QGraphicsObject *>(this) : nullptr;
}
/*!
@@ -2224,7 +2224,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const
return false;
- QGraphicsItem *dummy = 0;
+ QGraphicsItem *dummy = nullptr;
if (!blockingPanel)
blockingPanel = &dummy;
@@ -2420,7 +2420,7 @@ bool QGraphicsItem::isVisibleTo(const QGraphicsItem *parent) const
if (p->d_ptr->explicitlyHidden)
return false;
} while ((p = p->d_ptr->parent));
- return parent == 0;
+ return parent == nullptr;
}
/*!
@@ -2959,7 +2959,7 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect)
if (d_ptr->graphicsEffect) {
delete d_ptr->graphicsEffect;
- d_ptr->graphicsEffect = 0;
+ d_ptr->graphicsEffect = nullptr;
} else if (d_ptr->parent) {
d_ptr->parent->d_ptr->updateChildWithGraphicsEffectFlagRecursively();
}
@@ -2984,7 +2984,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively()
if (itemPrivate->mayHaveChildWithGraphicsEffect)
return;
itemPrivate->mayHaveChildWithGraphicsEffect = 1;
- } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
+ } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr));
#endif
}
@@ -3396,13 +3396,13 @@ void QGraphicsItem::setActive(bool active)
if (!activePanel || activePanel == thisPanel) {
// Deactivate this item, and reactivate the parent panel,
// or the last active panel (if any).
- QGraphicsItem *nextToActivate = 0;
+ QGraphicsItem *nextToActivate = nullptr;
if (d_ptr->parent)
nextToActivate = d_ptr->parent->panel();
if (!nextToActivate)
nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
if (nextToActivate == this || isAncestorOf(nextToActivate))
- nextToActivate = 0;
+ nextToActivate = nullptr;
d_ptr->scene->setActivePanel(nextToActivate);
}
}
@@ -3499,7 +3499,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
// Update the child focus chain.
- QGraphicsItem *commonAncestor = 0;
+ QGraphicsItem *commonAncestor = nullptr;
if (scene && scene->focusItem() && scene->focusItem()->panel() == q_ptr->panel()) {
commonAncestor = scene->focusItem()->commonAncestorItem(f);
scene->focusItem()->d_ptr->clearSubFocus(scene->focusItem(), commonAncestor);
@@ -3552,7 +3552,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB
while (p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
if (p->d_ptr->focusScopeItem == q_ptr) {
- p->d_ptr->focusScopeItem = 0;
+ p->d_ptr->focusScopeItem = nullptr;
if (!subFocusItem->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere
focusScopeItemChange(false);
}
@@ -3572,7 +3572,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent, bool hiddenB
clearSubFocus(q_ptr);
// If this item has the scene's input focus, clear it.
- scene->setFocusItem(0);
+ scene->setFocusItem(nullptr);
}
}
@@ -3621,7 +3621,7 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
qWarning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
return;
}
- for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) {
+ for (QGraphicsItem *f = item->focusProxy(); f != nullptr; f = f->focusProxy()) {
if (f == this) {
qWarning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item);
return;
@@ -4452,7 +4452,7 @@ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) c
QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) const
{
// Catch simple cases first.
- if (other == 0) {
+ if (other == nullptr) {
qWarning("QGraphicsItem::itemTransform: null pointer passed");
return QTransform();
}
@@ -4892,7 +4892,7 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling)
}
QList<QGraphicsItem *> *siblings = d_ptr->parent
? &d_ptr->parent->d_ptr->children
- : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : 0);
+ : (d_ptr->scene ? &d_ptr->scene->d_func()->topLevelItems : nullptr);
if (!siblings) {
qWarning("QGraphicsItem::stackUnder: cannot stack under %p, which must be a sibling", sibling);
return;
@@ -4949,7 +4949,7 @@ QRectF QGraphicsItem::childrenBoundingRect() const
return d_ptr->childrenBoundingRect;
d_ptr->childrenBoundingRect = QRectF();
- d_ptr->childrenBoundingRectHelper(0, &d_ptr->childrenBoundingRect, 0);
+ d_ptr->childrenBoundingRectHelper(nullptr, &d_ptr->childrenBoundingRect, nullptr);
d_ptr->dirtyChildrenBoundingRect = 0;
return d_ptr->childrenBoundingRect;
}
@@ -5422,7 +5422,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c
// Render
QStyleOptionGraphicsItem option;
- const_cast<QGraphicsItem *>(this)->paint(&p, &option, 0);
+ const_cast<QGraphicsItem *>(this)->paint(&p, &option, nullptr);
p.end();
// Transform QRegion back to device space
@@ -5575,7 +5575,7 @@ void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively()
if (!itemPrivate->updateDueToGraphicsEffect)
static_cast<QGraphicsItemEffectSourcePrivate *>(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache();
}
- } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0));
+ } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : nullptr));
}
void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::InvalidateReason reason)
@@ -5739,7 +5739,7 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost
if (*topMostDirtyItem == q_ptr) {
if (!dirtySceneTransform)
return; // OK, neither my ancestors nor I have dirty scene transforms.
- *topMostDirtyItem = 0;
+ *topMostDirtyItem = nullptr;
} else if (*topMostDirtyItem) {
return; // Continue backtrack.
}
@@ -5771,7 +5771,7 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *s
if (parent != q_ptr && parent->d_ptr->subFocusItem) {
if (parent->d_ptr->subFocusItem == q_ptr)
break;
- parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(0, stopItem);
+ parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(nullptr, stopItem);
}
parent->d_ptr->subFocusItem = q_ptr;
parent->d_ptr->subFocusItemChange();
@@ -5793,7 +5793,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem
do {
if (parent->d_ptr->subFocusItem != q_ptr)
break;
- parent->d_ptr->subFocusItem = 0;
+ parent->d_ptr->subFocusItem = nullptr;
if (parent != stopItem && !parent->isAncestorOf(stopItem))
parent->d_ptr->subFocusItemChange();
} while (!parent->isPanel() && (parent = parent->d_ptr->parent));
@@ -5808,7 +5808,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem
void QGraphicsItemPrivate::resetFocusProxy()
{
for (int i = 0; i < focusProxyRefs.size(); ++i)
- *focusProxyRefs.at(i) = 0;
+ *focusProxyRefs.at(i) = nullptr;
focusProxyRefs.clear();
}
@@ -7322,7 +7322,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
// Find the active view.
- QGraphicsView *view = 0;
+ QGraphicsView *view = nullptr;
if (event->widget())
view = qobject_cast<QGraphicsView *>(event->widget()->parentWidget());
@@ -7330,7 +7330,7 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
int i = 0;
bool movedMe = false;
while (i <= selectedItems.size()) {
- QGraphicsItem *item = 0;
+ QGraphicsItem *item = nullptr;
if (i < selectedItems.size())
item = selectedItems.at(i);
else
@@ -7891,7 +7891,7 @@ void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObj
if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
item->setParentItem(graphicsObject);
} else {
- QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
+ QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, nullptr, nullptr);
}
}
}
@@ -7908,7 +7908,7 @@ QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGra
if (index >= 0 && index < d->children.count())
return d->children.at(index)->toGraphicsObject();
else
- return 0;
+ return nullptr;
}
void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObject> *list)
@@ -7917,10 +7917,10 @@ void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty<QGraphicsObje
int childCount = d->children.count();
if (d->sendParentChangeNotification) {
for (int index = 0; index < childCount; index++)
- d->children.at(0)->setParentItem(0);
+ d->children.at(0)->setParentItem(nullptr);
} else {
for (int index = 0; index < childCount; index++)
- QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0);
+ QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(nullptr, nullptr, nullptr);
}
}
@@ -9949,7 +9949,7 @@ class QGraphicsTextItemPrivate
{
public:
QGraphicsTextItemPrivate()
- : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0)
+ : control(nullptr), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0)
{ }
mutable QWidgetTextControl *control;
@@ -11232,7 +11232,7 @@ void QGraphicsItemGroup::removeFromGroup(QGraphicsItem *item)
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item->setTransform(itemTransform);
- item->d_func()->setIsMemberOfGroup(item->group() != 0);
+ item->d_func()->setIsMemberOfGroup(item->group() != nullptr);
// ### Quite expensive. But removeFromGroup() isn't called very often.
prepareGeometryChange();
@@ -11412,18 +11412,18 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QTransform sceneTransform = item->sceneTransform();
QTransform newEffectTransform = sceneTransform.inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, 0, &sceneTransform, 0, 0, qreal(1.0),
+ scened->draw(item, &pixmapPainter, nullptr, &sceneTransform, nullptr, nullptr, qreal(1.0),
&newEffectTransform, false, true);
} else if (deviceCoordinates) {
// Device coordinates with info.
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr,
info->widget, info->opacity, &effectTransform, info->wasDirtySceneTransform,
info->drawItem);
} else {
// Item coordinates with info.
QTransform newEffectTransform = info->transformPtr->inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, nullptr,
info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform,
info->drawItem);
}