[Development] Proposal: Deprecating platforms in Qt 5.6 that don't support lambda

André Somers andre at familiesomers.nl
Fri Feb 20 12:52:31 CET 2015


Olivier Goffart schreef op 20-2-2015 om 12:22:
> On Friday 20 February 2015 11:38:21 André Somers wrote:
>> Olivier Goffart schreef op 20-2-2015 om 11:38:
>>> On Friday 20 February 2015 11:26:31 Daniel Teske wrote:
>>> [...]
>>>
>>>> That's one area. The others are too replace trivial interfaces with a low
>>>> amount of virtual functions by a std::function properties. This can
>>>> simplify code if e.g. the different implementations don't fit into a
>>>> nice hierarchy.>
>>> Note that the Qt ABI (in practice, the Qt public API) cannot use
>>> std::function because we don't use stl types in our ABI.
>>>
>>> So we must roll our own (QFunction).
>>> (or change the policy)
>> We already have, don't we? After all, QObject::connect takes a lambda or
>> a function-like object...
> YEs, but that's not std::function and that's not having the same feature
>
> QObject::connect takes a template type.
> Then QObject::connectImpl takes a QtPrivate::QSlotObjectBase which has it's
> own interface tight to the need of QObject::connect.
>
> If you wanted to support, implement, say,
> 	QSortFilterProxyModel::setFilter(
> 		cont std::function<bool(int, const QModelIndex&)> &filter)
>
> You would need a generic general purpose QFunction. For which you can specify
> the arguments as template parameter.
>
Ok, thanks for the clarification. And that's exactly the kind of thing 
I'd like to see supported. Though I'd rather not have the QFunction 
then, but just be able to use std::function.

André




More information about the Development mailing list