D19317: compile without foreach

Aleix Pol Gonzalez noreply at phabricator.kde.org
Tue Feb 26 14:51:27 GMT 2019


apol added inline comments.

INLINE COMMENTS

> pic.cpp:391
>              m_description.clear();
> -            QStringList entries = value.toString().split(QStringLiteral("\n\n"));
> -            Q_FOREACH(const QString entry, entries) {
> +            const QStringList entries = value.toString().split(QStringLiteral("\n\n"));
> +            for (const QString &entry : entries) {

Probably could do a splitRef here

> imageconverter.cpp:67
>          out << "Input formats:\n";
> -        foreach (const QByteArray &fmt, QImageReader::supportedImageFormats()) {
> +        const QList<QByteArray> lstReaderSupportedFormats = QImageReader::supportedImageFormats();
> +        for (const QByteArray &fmt : lstReaderSupportedFormats) {

I'd use auto in this cases, otherwise you're creating a dependency to the type.

REPOSITORY
  R287 KImageFormats

REVISION DETAIL
  https://phabricator.kde.org/D19317

To: mlaurent, dfaure
Cc: apol, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190226/278694a9/attachment.html>


More information about the Kde-frameworks-devel mailing list