mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-01 08:52:45 +00:00
WIP: Slowly bringing back viewmodels
This commit is contained in:
parent
9abee12658
commit
228f81984b
17 changed files with 292 additions and 96 deletions
|
@ -152,9 +152,24 @@ QJsonValue toJsonValue(const QSharedPointer<T> &source, convertType<QSharedPoint
|
|||
/**
|
||||
* Templates for string conversion.
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
QString toString(const T &source, convertType<T>) {
|
||||
return toJsonValue(source).toString();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QString toString(const std::optional<T> &source, convertType<std::optional<T>>) {
|
||||
if (source.has_value()) {
|
||||
return toString<T>(source.value(), convertType<T>{});
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
QString toString(const T &source) {
|
||||
return toJsonValue(source).toString();
|
||||
return toString(source, convertType<T>{});
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue