From 6edbbd3df4bc1626c4a1ae77c80b416993e829fc Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Fri, 4 Jul 2014 11:38:34 +0200 Subject: [PATCH] make privateHints mutable, so we can use them to cache stuff for applications even if we only acces them from a notification --- src/core/hint.cpp | 4 ++-- src/core/hint.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/hint.cpp b/src/core/hint.cpp index c83947c..691a11e 100644 --- a/src/core/hint.cpp +++ b/src/core/hint.cpp @@ -55,13 +55,13 @@ bool Hint::contains(const QString &key) const return m_data.contains(key.toLower()); } -void Hint::setPrivateValue(const void *owner, const QString &key, const QVariant &value) +void Hint::setPrivateValue(const void *owner, const QString &key, const QVariant &value) const { QPair pk((quintptr)owner,key.toLower()); m_privateData.insert(pk, value); } -void Hint::setPrivateValue(const void *owner, const QString &key, QObject *value) +void Hint::setPrivateValue(const void *owner, const QString &key, QObject *value) const { QPair pk((quintptr)owner,key.toLower()); m_privateData.insert(pk, qVariantFromValue(value)); diff --git a/src/core/hint.h b/src/core/hint.h index d3872e8..101ad0d 100644 --- a/src/core/hint.h +++ b/src/core/hint.h @@ -79,7 +79,7 @@ public: * @param key the key * @param value the value */ - void setPrivateValue(const void *owner, const QString &key, const QVariant &value); + void setPrivateValue(const void *owner, const QString &key, const QVariant &value) const; /** * Sets the value for the key depending on the owner @@ -87,7 +87,7 @@ public: * @param key the key * @param value the value */ - void setPrivateValue(const void *owner, const QString &key, QObject *value); + void setPrivateValue(const void *owner, const QString &key, QObject *value) const; /** * The associated value of the key if present, returns the default value otherwise. @@ -110,7 +110,7 @@ private slots: private: QVariantHash m_data; - QHash, QVariant> m_privateData; + mutable QHash, QVariant> m_privateData; friend SNORE_EXPORT QDebug (::operator<<) ( QDebug, const Snore::Hint &);