diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-23 16:19:11 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-02-09 11:30:02 +0000 |
commit | 868201155fd677dbc6d14346f5ea61e82ebce27b (patch) | |
tree | 75d02a144c205d659e5851f95f306e3a12b0ff5e /src/corelib/itemmodels | |
parent | 6389160f04322449c34bd1ecfe53983e3b588943 (diff) |
QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<
Unify the behavior of the different operator<< by always using
QDebugStateSaver (appending an optional space at exit), and making
sure that the space(), nospace() setting isn't 'leaked'.
Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 5 | ||||
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.cpp | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 43b51bcaf5..7eed37033c 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -449,9 +449,10 @@ bool QPersistentModelIndex::isValid() const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QModelIndex &idx) { + QDebugStateSaver saver(dbg); dbg.nospace() << "QModelIndex(" << idx.row() << ',' << idx.column() << ',' << idx.internalPointer() << ',' << idx.model() << ')'; - return dbg.space(); + return dbg; } QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx) diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 920190e712..f1dd503bff 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -1849,9 +1849,10 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QItemSelectionRange &range) { + QDebugStateSaver saver(dbg); dbg.nospace() << "QItemSelectionRange(" << range.topLeft() << ',' << range.bottomRight() << ')'; - return dbg.space(); + return dbg; } #endif |