summaryrefslogtreecommitdiffstats
path: root/examples/corelib/serialization/savegame/game.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-02-23 11:58:51 +0100
committerMarc Mutz <marc.mutz@qt.io>2023-05-09 08:21:10 +0200
commit6f1e53943d463978d2a3ae226fdeea78b06df34c (patch)
tree049ef35b837f835842bd0d143e9e2267d070ac30 /examples/corelib/serialization/savegame/game.h
parent7b7a01c266b507636eab51a36328c7c72d82d93c (diff)
savegame ex.: revamp the way print() works
Basically, instead of re-creating QTextStreams all the time, create it once, in main(), and then pass it to print() alongside the int indentation. Also fix a hard-coded indentation value that should have been relative to the caller's indentation level. Pick-to: 6.5 6.2 Task-number: QTBUG-108857 Change-Id: I811447295c9c3fdef23f61aff31ebe82941eb3b4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'examples/corelib/serialization/savegame/game.h')
-rw-r--r--examples/corelib/serialization/savegame/game.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/corelib/serialization/savegame/game.h b/examples/corelib/serialization/savegame/game.h
index 4c72ea426e..2d7630c7df 100644
--- a/examples/corelib/serialization/savegame/game.h
+++ b/examples/corelib/serialization/savegame/game.h
@@ -10,6 +10,8 @@
#include <QJsonObject>
#include <QList>
+QT_FORWARD_DECLARE_CLASS(QTextStream)
+
//! [0]
class Game
{
@@ -28,7 +30,7 @@ public:
void read(const QJsonObject &json);
QJsonObject toJson() const;
- void print(int indentation = 0) const;
+ void print(QTextStream &s, int indentation = 0) const;
private:
Character mPlayer;
QList<Level> mLevels;