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

Reply via email to