D25326: Move Plasma's SortFilterProxyModel into KItemModel's QML plugin

Arjen Hiemstra noreply at phabricator.kde.org
Wed Jan 29 16:22:16 GMT 2020


ahiemstra added inline comments.

INLINE COMMENTS

> ksortfilterproxymodel.cpp:74
> +        QJSValueList args = {QJSValue(source_row), engine->toScriptValue(source_parent)};
> +        return const_cast<KSortFilterProxyModel *>(this)->m_filterCallback.call(args).toBool();
> +    }

Suggestion: Instead of directly returning the value, do this: (Also for filterAcceptsColumn below)

  auto result = const_cast<KSortFilterProxyModel *>(this)->m_filterCallback.call(args);
  if (result.isError()) {
      qCWarning(KITEMMODELS_LOG) << "Row filter callback produced an error:";
      qCWarning(KITEMMODELS_LOG) << result.toString();
  } else {
      return result.toBool();
  }

That way at least some error will be displayed when the callback fails.

REPOSITORY
  R275 KItemModels

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

To: davidedmundson
Cc: kmaterka, iasensio, ahmadsamir, broulik, ahiemstra, mart, 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/20200129/96b9d1c5/attachment.html>


More information about the Kde-frameworks-devel mailing list