qgraphicsitem_cast: replace 0 with nullptr

While headerscheck doesn't detect this (generic code), this might
trigger warnings in user code.

Change-Id: I6183323d0a1c73b021699d4c4afa2d1fcf71aad2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit a9cabed4399fa73cdd741d781426205128c35ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-07-01 13:03:50 +02:00 committed by Qt Cherry-pick Bot
parent 2a056cd39f
commit bf0b5dc516

View File

@ -973,14 +973,14 @@ template <class T> inline T qgraphicsitem_cast(QGraphicsItem *item)
{
typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type Item;
return int(Item::Type) == int(QGraphicsItem::Type)
|| (item && int(Item::Type) == item->type()) ? static_cast<T>(item) : 0;
|| (item && int(Item::Type) == item->type()) ? static_cast<T>(item) : nullptr;
}
template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item)
{
typedef typename std::remove_cv<typename std::remove_pointer<T>::type>::type Item;
return int(Item::Type) == int(QGraphicsItem::Type)
|| (item && int(Item::Type) == item->type()) ? static_cast<T>(item) : 0;
|| (item && int(Item::Type) == item->type()) ? static_cast<T>(item) : nullptr;
}
#ifndef QT_NO_DEBUG_STREAM