all: use BINDABLE only with trivial setters

Fixes various bugs caused by the QML engine bypassing setters
when BINDABLE is specified (even if the bindable is const).
Also restructures all properties using BINDABLE to have
a default READ and WRITE to ensure this doesn't happen again.
This commit is contained in:
outfoxxed 2025-05-29 16:05:30 -07:00
parent 2e3c15f7a1
commit b67f92bc13
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
10 changed files with 167 additions and 180 deletions

View file

@ -282,15 +282,6 @@ bool setSimpleObjectHandle(auto* parent, auto* value) {
return SimpleObjectHandleOps<member, destroyedSlot, changedSignal>::setObject(parent, value);
}
// NOLINTBEGIN
#define QS_TRIVIAL_GETTER(Type, member, getter) \
[[nodiscard]] Type getter() { return this->member; }
#define QS_BINDABLE_GETTER(Type, member, getter, bindable) \
[[nodiscard]] Type getter() { return this->member.value(); } \
[[nodiscard]] QBindable<Type> bindable() { return &this->member; }
// NOLINTEND
template <auto methodPtr>
class MethodFunctor {
using PtrMeta = MemberPointerTraits<decltype(methodPtr)>;