D26890: QXmlInputSource is deprecated in qt5.15. Port it to QXmlStreamReader

Aleix Pol Gonzalez noreply at phabricator.kde.org
Sun Jan 26 13:14:37 GMT 2020


apol added inline comments.

INLINE COMMENTS

> kconfigloader.cpp:77
> +        case QXmlStreamReader::Characters:
> +            if (!reader.isWhitespace() && !reader.text().toString().trimmed().isEmpty()) {
> +                if (!characters(reader.text()))

No need to construct a QString if it's just to check if it's empty.

> kconfigloader.cpp:106
> +            QString name = attrs.at(i).name().toString().toLower();
>              if (name == QLatin1String("name")) {
>                  //qDebug() << "set group to" << attrs.value(i);

This comparison doesn't need to be onto a converted QString. You can compare against the QStringRef and use QStringRef::compare to make it case insensitive.

> kconfigloader.cpp:140
> +            const QString name = attrs.at(i).name().toString().toLower();
>              if (name == QLatin1String("name")) {
> +                m_choice.name = attrs.at(i).value().toString();

Use QStringRef::compare()

> kconfigloader.cpp:194
> +    const QString tag = localName.toString().toLower();
>      if (tag == QLatin1String("entry")) {
>          addItem();

I'd also use QStringRef::compare here

REPOSITORY
  R237 KConfig

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

To: mlaurent, dfaure
Cc: apol, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200126/60e585f1/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list