summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-01 16:40:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-04-01 16:18:38 +0000
commit075c0298d1c75dd2d61849b559edcb357d638689 (patch)
treeefda3ff4eec42651befd024c3489b845ecd0af3e
parent5bc470958f7feabd125aa6ba6e7c487da821cb0b (diff)
Use QDebugStateSaver to restore space setting in stream operators.
Returning dbg.space() breaks formatting on streams that already have nospace() set. Change-Id: I645a3a06176a394921e75b56dd725f291db55fb3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/core/bounds/qaxisalignedboundingbox.cpp5
-rw-r--r--src/core/qray3d.cpp3
-rw-r--r--src/core/resources/qhandle.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/core/bounds/qaxisalignedboundingbox.cpp b/src/core/bounds/qaxisalignedboundingbox.cpp
index f539173b0..21bb55bb4 100644
--- a/src/core/bounds/qaxisalignedboundingbox.cpp
+++ b/src/core/bounds/qaxisalignedboundingbox.cpp
@@ -84,8 +84,9 @@ void QAxisAlignedBoundingBox::update(const QVector<QVector3D> &points)
QDebug operator<<(QDebug dbg, const QAxisAlignedBoundingBox &c)
{
- dbg.nospace() << "AABB ( min:" << c.minPoint() << ", max:" << c.maxPoint() << ")";
- return dbg.space();
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "AABB ( min:" << c.minPoint() << ", max:" << c.maxPoint() << ')';
+ return dbg;
}
} //namespace Qt3D
diff --git a/src/core/qray3d.cpp b/src/core/qray3d.cpp
index 0783c5aa1..109fbc41b 100644
--- a/src/core/qray3d.cpp
+++ b/src/core/qray3d.cpp
@@ -311,12 +311,13 @@ float QRay3D::distance(const QVector3D &point) const
QDebug operator<<(QDebug dbg, const QRay3D &ray)
{
+ QDebugStateSaver saver(dbg);
dbg.nospace() << "QRay3D(origin("
<< ray.origin().x() << ", " << ray.origin().y() << ", "
<< ray.origin().z() << ") - direction("
<< ray.direction().x() << ", " << ray.direction().y() << ", "
<< ray.direction().z() << "))";
- return dbg.space();
+ return dbg;
}
#endif
diff --git a/src/core/resources/qhandle.h b/src/core/resources/qhandle.h
index e64b9d6ca..64957f145 100644
--- a/src/core/resources/qhandle.h
+++ b/src/core/resources/qhandle.h
@@ -104,12 +104,13 @@ private:
template <typename T, uint INDEXBITS>
QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h)
{
+ QDebugStateSaver saver(dbg);
QString binNumber = QString::number(h.handle(), 2).rightJustified(32, QChar::fromLatin1('0'));
dbg.nospace() << "index = " << h.index()
<< " magic/counter = " << h.counter()
<< " m_handle = " << h.handle()
<< " = " << binNumber;
- return dbg.space();
+ return dbg;
}
} // Qt3D