[Qgis-developer] Replacing Q_FOREACH in Qgis code

Larry Shaffer larrys at dakotacarto.com
Thu Jan 19 17:30:46 PST 2017


Hi David,

Thanks for bringing this up. After reading the referenced KDAB article (and
especially the not-so-happy comments about this deprecation), I looked at
the code base.

Instances of Q_FOREACH in QGIS 2.99 (master): 2023

Why can't Qt just leave the macro in and recommend using a better C++11
construct for devs wishing better performance? (rhetorical question)

I guess the macro can be added to a QGIS header file while devs spend their
time endlessly figuring out how to do a port "for each" Q_FOREACH.

I, for one, find this a bit annoying on Qt's part, but still understand the
reasoning for it.

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

On Thu, Jan 19, 2017 at 3:28 AM, David Marteau <dmarteau at 3liz.com> wrote:

> Hi,
>
> I would like to know if there is plans for replacing Q_FOREACH (use
> discouraged from QT 5.7) with C++11 range based loop in QGIS code and if it
> is appropriate to start the move in new PR ?
>
> Some références:
> http://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH
> http://en.cppreference.com/w/cpp/language/range-for
> https://www.kdab.com/goodbye-q_foreach/
>
> Thx
> David
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170119/3cb4ca0b/attachment.html>


More information about the Qgis-developer mailing list