From e04d9276b9cb08d7ef83becba3a66b081af16f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= Date: Wed, 6 Nov 2024 14:48:24 +0100 Subject: [PATCH] Remove TODO statement from QWinRegistryKey::stringValue() QWinRegistryKey::stringValue is more readable than key::value().value_or(QString()). This patch also adds developer documentation for the function. Change-Id: I6a760db77a50ca9fa810196e14af14068df8aee3 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira (cherry picked from commit 16ca13e148445b5a18ea768c096dfedfbacce3c4) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qwinregistry.cpp | 4 ++++ src/corelib/kernel/qwinregistry_p.h | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qwinregistry.cpp b/src/corelib/kernel/qwinregistry.cpp index 59d30fd4a35..cac5769e3b9 100644 --- a/src/corelib/kernel/qwinregistry.cpp +++ b/src/corelib/kernel/qwinregistry.cpp @@ -120,6 +120,10 @@ QVariant QWinRegistryKey::value(QStringView subKey) const return {}; } +// Returns the value of the specified subKey as a string, obtained using +// qvariant_cast from the underlying QVariant. If that value is not a string, +// or the subKey has no value, a string whose isNull() is true is returned. +// Otherwise, the resulting string (which may be empty) is returned. QString QWinRegistryKey::stringValue(QStringView subKey) const { return value(subKey).value_or(QString()); diff --git a/src/corelib/kernel/qwinregistry_p.h b/src/corelib/kernel/qwinregistry_p.h index e767e92f92a..8623ab1b1c6 100644 --- a/src/corelib/kernel/qwinregistry_p.h +++ b/src/corelib/kernel/qwinregistry_p.h @@ -56,7 +56,6 @@ public: return std::nullopt; } - // ### TODO: Remove once all usages are migrated to new interface. QString stringValue(QStringView subKey) const; private: