A QString is not a full representation of a Level, so the Level(QString) ctor should be explicit. Task-number: QTBUG-108857 Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit fa55d46e1f09ddf45dbe5700d4637b003363c559) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
35 lines
627 B
C++
35 lines
627 B
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef LEVEL_H
|
|
#define LEVEL_H
|
|
|
|
#include "character.h"
|
|
|
|
#include <QJsonObject>
|
|
#include <QList>
|
|
|
|
//! [0]
|
|
class Level
|
|
{
|
|
public:
|
|
Level() = default;
|
|
explicit Level(const QString &name);
|
|
|
|
QString name() const;
|
|
|
|
QList<Character> npcs() const;
|
|
void setNpcs(const QList<Character> &npcs);
|
|
|
|
void read(const QJsonObject &json);
|
|
void write(QJsonObject &json) const;
|
|
|
|
void print(int indentation = 0) const;
|
|
private:
|
|
QString mName;
|
|
QList<Character> mNpcs;
|
|
};
|
|
//! [0]
|
|
|
|
#endif // LEVEL_H
|