diff --git a/include/FramelessHelper/Core/private/registrykey_p.h b/include/FramelessHelper/Core/private/registrykey_p.h index dd2a845..72ade24 100644 --- a/include/FramelessHelper/Core/private/registrykey_p.h +++ b/include/FramelessHelper/Core/private/registrykey_p.h @@ -83,9 +83,9 @@ private: Global::RegistryRootKey m_rootKey = Global::RegistryRootKey::CurrentUser; QString m_subKey = {}; #if REGISTRYKEY_QWINREGISTRYKEY - std::unique_ptr m_registryKey = nullptr; + QScopedPointer m_registryKey; #else - std::unique_ptr m_settings = nullptr; + QScopedPointer m_settings; #endif }; diff --git a/src/core/registrykey.cpp b/src/core/registrykey.cpp index 25645b3..21cb472 100644 --- a/src/core/registrykey.cpp +++ b/src/core/registrykey.cpp @@ -85,17 +85,16 @@ RegistryKey::RegistryKey(const RegistryRootKey root, const QString &key, QObject m_rootKey = root; m_subKey = key; #if REGISTRYKEY_QWINREGISTRYKEY - m_registryKey = std::make_unique(g_keyMap[static_cast(m_rootKey)], m_subKey); + m_registryKey.reset(new QWinRegistryKey(g_keyMap[static_cast(m_rootKey)], m_subKey)); if (!m_registryKey->isValid()) { m_registryKey.reset(); } #else const QString rootKey = g_strMap[static_cast(m_rootKey)]; const auto lastSlashPos = m_subKey.lastIndexOf(u'\\'); - m_settings = std::make_unique(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat); + m_settings.reset(new QSettings(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat)); if (m_settings->childGroups().contains(m_subKey.mid(lastSlashPos + 1))) { - m_settings.reset(); - m_settings = std::make_unique(rootKey + u'\\' + m_subKey, QSettings::NativeFormat); + m_settings.reset(new QSettings(rootKey + u'\\' + m_subKey, QSettings::NativeFormat)); } else { m_settings.reset(); } @@ -117,9 +116,9 @@ QString RegistryKey::subKey() const bool RegistryKey::isValid() const { #if REGISTRYKEY_QWINREGISTRYKEY - return (m_registryKey && m_registryKey->isValid()); + return (!m_registryKey.isNull() && m_registryKey->isValid()); #else - return m_settings; + return !m_settings.isNull(); #endif }