diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-04-13 15:05:42 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-04-14 09:24:33 +0200 |
commit | d5b79e876e38e03d105300d461af168894456acd (patch) | |
tree | ca80e2a1b00e734c08be532b2215c342ad15aae1 /src/corelib/kernel/qproperty.h | |
parent | 865f3c2a11a7e7e1dedbb216669cdc2e091f45db (diff) |
QBindable: Mark non-modifying methods as const
A few methods in QBindable which do not modify anything were not marked
as const so far. This adds the missing const, and a test to verify that
they work.
As all methods are fully inline, this does not cause any binary
compatibility issues.
Fixes: QTBUG-89508
Change-Id: If06d33bc405232887b8c371c268840ba34dbadf6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty.h')
-rw-r--r-- | src/corelib/kernel/qproperty.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index a085aac3d1..717c6713d4 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -577,7 +577,7 @@ public: bool isBindable() const { return iface && iface->getBinding; } bool isReadOnly() const { return !(iface && iface->setBinding && iface->setObserver); } - QUntypedPropertyBinding makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) + QUntypedPropertyBinding makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const { return iface ? iface->makeBinding(data, location) : QUntypedPropertyBinding(); } @@ -597,14 +597,14 @@ public: return binding; } - void observe(QPropertyObserver *observer) + void observe(QPropertyObserver *observer) const { if (iface) iface->setObserver(data, observer); } template<typename Functor> - QPropertyChangeHandler<Functor> onValueChanged(Functor f) + QPropertyChangeHandler<Functor> onValueChanged(Functor f) const { QPropertyChangeHandler<Functor> handler(f); observe(&handler); @@ -612,7 +612,7 @@ public: } template<typename Functor> - QPropertyChangeHandler<Functor> subscribe(Functor f) + QPropertyChangeHandler<Functor> subscribe(Functor f) const { f(); return onValueChanged(f); @@ -658,7 +658,7 @@ public: } } - QPropertyBinding<T> makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) + QPropertyBinding<T> makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const { return static_cast<QPropertyBinding<T> &&>(QUntypedBindable::makeBinding(location)); } |