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

Ziller Eike Eike.Ziller at theqtcompany.com
Tue Feb 24 13:15:15 CET 2015


> On Feb 20, 2015, at 10:04 AM, André Somers <andre at familiesomers.nl> wrote:
> 
> Bo Thorsen schreef op 20-2-2015 om 09:03:
>> Andrés question about how this would change the API is a lot more 
>> interesting. I so far haven't seen a single case where someone has 
>> described how access to lambdas might improve the API.

Well, the new connect style is also already improved API.

>> If they are 
>> there, I'd love to see them, because maybe this would teach me 
>> something I haven't figured out yet.
> 
> One example I could come up with as a potential new API is 
> QSortFilterProxyModel. Currently, it requires subclassing to change the 
> sort or the filter functions: it supplies protected filterAcceptsRow, 
> filterAcceptsColumn and lessThan functions. I think that it would be 
> much more convenient if these filters and the comparator could be 
> supplied as a function object (a lambda, or a functor, or a std::mem_fn, 
> anything callable as a function). While this wasn't all that practical 
> in the past, I think C++/11 makes this much more convenient than 
> subclassing.

We start using these kind of patterns more and more in Qt Creator.

Another example in Qt might be

virtual QWebView * 
QWebView::createWindow(QWebPage::WebWindowType type) [protected]

which could instead be a setWindowFactory function (same in QWebEngine).

> This could of course just be added, instead of replacing. But that would 
> mean API bloat. Downside of replacing is of course: you break old code.
> 
> I think that if we go over the Qt classes, we'll find more examples of 
> where a subclass or a separate function that you need to write could be 
> replaced with a more modern API.
> 
> André
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
Eike Ziller, Senior Software Engineer - The Qt Company GmbH
 
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B




More information about the Development mailing list