1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-16 16:10:58 +00:00

Add and register SettingValue stream operators

This commit is contained in:
AnyOldName3 2024-04-01 00:15:58 +01:00
parent 47ef2d018f
commit bb3c22e4a5
2 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,11 @@ namespace
Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg)
: mCfgMgr(cfg)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// this needs calling once so Qt can see its stream operators, which it needs when dragging and dropping
// it's automatic with Qt 6
qRegisterMetaTypeStreamOperators<SettingValue>("Config::SettingValue");
#endif
}
void Config::GameSettings::validatePaths()
@ -591,3 +596,19 @@ void Config::GameSettings::clear()
mDataDirs.clear();
mDataLocal.clear();
}
QDataStream& Config::operator<<(QDataStream& out, const SettingValue& settingValue)
{
out << settingValue.value;
out << settingValue.originalRepresentation;
out << settingValue.context;
return out;
}
QDataStream& Config::operator>>(QDataStream& in, SettingValue& settingValue)
{
in >> settingValue.value;
in >> settingValue.originalRepresentation;
in >> settingValue.context;
return in;
}

View File

@ -132,6 +132,9 @@ namespace Config
static bool isOrderedLine(const QString& line);
};
QDataStream& operator<<(QDataStream& out, const SettingValue& settingValue);
QDataStream& operator>>(QDataStream& in, SettingValue& settingValue);
}
Q_DECLARE_METATYPE(Config::SettingValue)