From 6dab2577bfa57e242e9568047c976f5e509c03f4 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 2 Apr 2020 17:07:04 +0200 Subject: [PATCH] Constify parameter in QGraphicsItem/Object debug streaming operator Address FIXME comment. Change-Id: I55b6e458f2aead9baac8ab3bba7009ad993863e6 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge --- src/widgets/graphicsview/qgraphicsitem.cpp | 8 +++----- src/widgets/graphicsview/qgraphicsitem.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index af4443fa00..09c49a239f 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -11354,8 +11354,7 @@ static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item) debug << ", flags=" << item->flags(); } -// FIXME: Qt 6: Make this QDebug operator<<(QDebug debug, const QGraphicsItem *item) -QDebug operator<<(QDebug debug, QGraphicsItem *item) +QDebug operator<<(QDebug debug, const QGraphicsItem *item) { QDebugStateSaver saver(debug); debug.nospace(); @@ -11365,7 +11364,7 @@ QDebug operator<<(QDebug debug, QGraphicsItem *item) return debug; } - if (QGraphicsObject *o = item->toGraphicsObject()) + if (const QGraphicsObject *o = item->toGraphicsObject()) debug << o->metaObject()->className(); else debug << "QGraphicsItem"; @@ -11386,8 +11385,7 @@ QDebug operator<<(QDebug debug, QGraphicsItem *item) return debug; } -// FIXME: Qt 6: Make this QDebug operator<<(QDebug debug, const QGraphicsObject *item) -QDebug operator<<(QDebug debug, QGraphicsObject *item) +QDebug operator<<(QDebug debug, const QGraphicsObject *item) { QDebugStateSaver saver(debug); debug.nospace(); diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index c78d31bbd4..0fb46fc9a8 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -1032,8 +1032,8 @@ template inline T qgraphicsitem_cast(const QGraphicsItem *item) } #ifndef QT_NO_DEBUG_STREAM -Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); -Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, const QGraphicsItem *item); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, const QGraphicsObject *item); Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags);