30 Q_DISABLE_COPY(QWinRegistryKey)
34 QWinRegistryKey(QObject *parent =
nullptr);
35 explicit QWinRegistryKey(HKEY parentHandle,
const wchar_t *subKey,
36 REGSAM permissions = KEY_READ, REGSAM access = 0,
37 QObject *parent =
nullptr);
38 explicit QWinRegistryKey(HKEY parentHandle,
const QString &subKey,
39 REGSAM permissions = KEY_READ, REGSAM access = 0,
40 QObject *parent =
nullptr);
43 QWinRegistryKey(QWinRegistryKey &&other)
noexcept
44 : m_key(std::exchange(other.m_key,
nullptr)) {}
45 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QWinRegistryKey)
46 void swap(QWinRegistryKey &other)
noexcept
48 qt_ptr_swap(m_key, other.m_key);
51 [[nodiscard]]
bool isValid()
const {
return m_key !=
nullptr; }
53 [[nodiscard]] HKEY handle()
const {
return m_key; }
55 operator HKEY()
const {
return handle(); }
61 [[nodiscard]] QVariant value(
const wchar_t *subKey)
const;
62 [[nodiscard]] QVariant value(
const QString &subKey)
const;
65 [[nodiscard]] std::optional<T> value(
const wchar_t *subKey)
const
67 return to_optional<T>(value(subKey));
71 [[nodiscard]] std::optional<T> value(
const QString &subKey)
const
73 return to_optional<T>(value(subKey));
76 QString stringValue(
const wchar_t *subKey)
const;
77 QString stringValue(
const QString &subKey)
const;
79#ifndef QT_NO_DEBUG_STREAM
80 friend Q_CORE_EXPORT QDebug operator<<(QDebug dbg,
const QWinRegistryKey &);
87 void connectNotify(
const QMetaMethod &signal) override;
91 static std::optional<T> to_optional(QVariant v)
94 return qvariant_cast<T>(std::move(v));
99 QUniqueWin32NullHandle m_keyChangedEvent;