Browse Source

qt: allow navigation functions to fallback to default behaviour

pull/144/head
Prince Gupta 3 years ago
committed by Jean-Baptiste Kempf
parent
commit
62e94c6d8f
  1. 11
      modules/gui/qt/widgets/native/navigation_attached.cpp

11
modules/gui/qt/widgets/native/navigation_attached.cpp

@ -36,9 +36,16 @@ void NavigationAttached::defaultNavigationGeneric(QJSValue& jsCallback, QQuickIt
Qt::FocusReason reason)
{
if (jsCallback.isCallable()) {
jsCallback.call();
const auto ret = jsCallback.call();
// if the function returns nothing or true, the action has been handled, stop the traversal
// if the function returns a false explictly, continue traversal
if (!ret.isBool() || ret.toBool())
return;
}
else if (directionItem)
if (directionItem)
{
NavigationAttached* nextItem = qobject_cast<NavigationAttached*>(qmlAttachedPropertiesObject<NavigationAttached>(directionItem));
if (directionItem->isVisible()

Loading…
Cancel
Save