mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 16:32:33 +02:00
Replace {} with explicit std::nullopt
This commit is contained in:
parent
bbb70ece42
commit
c7d93b3fae
@ -49,7 +49,7 @@ std::optional<QJsonObject> Util::openJsonFileToObject(const QString& path)
|
|||||||
auto jsonString = openJsonFileToString(path);
|
auto jsonString = openJsonFileToString(path);
|
||||||
|
|
||||||
if (!jsonString.has_value()) {
|
if (!jsonString.has_value()) {
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonDocument jsonDocument;
|
QJsonDocument jsonDocument;
|
||||||
@ -58,7 +58,7 @@ std::optional<QJsonObject> Util::openJsonFileToObject(const QString& path)
|
|||||||
|
|
||||||
if (!(parseError.error == QJsonParseError::NoError)) {
|
if (!(parseError.error == QJsonParseError::NoError)) {
|
||||||
qWarning() << "Settings Json Parse Error: " << parseError.errorString();
|
qWarning() << "Settings Json Parse Error: " << parseError.errorString();
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonDocument.object();
|
return jsonDocument.object();
|
||||||
@ -69,7 +69,7 @@ std::optional<QString> Util::openJsonFileToString(const QString& path)
|
|||||||
QFile file;
|
QFile file;
|
||||||
file.setFileName(path);
|
file.setFileName(path);
|
||||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
QString fileContent = file.readAll();
|
QString fileContent = file.readAll();
|
||||||
file.flush();
|
file.flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user