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

Olivier Goffart olivier at woboq.com
Fri Feb 20 12:22:53 CET 2015


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.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org




More information about the Development mailing list