# HG changeset patch # User John W. Eaton # Date 1605162089 18000 # Node ID 0678fdb81efc686034778dcf8affcbc9d2d31e20 # Parent 6ecc75589cbc28fabaa2a24da7dbe0af7ce31235 avoid deprecated QHelpEngine::linksForIdentifier function * documentation.cc (void documentation::load_ref): If it is available, call QHelpEngine::documentsForIdentifier instead of QHelpEngine::linksForIdentifier. Adapt to different type of returned object. * acinclude.m4 (OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER): New macro. (OCTAVE_CHECK_QT_VERSION): Use it. diff -r 6ecc75589cbc -r 0678fdb81efc libgui/src/documentation.cc --- a/libgui/src/documentation.cc Thu Nov 12 01:17:52 2020 -0500 +++ b/libgui/src/documentation.cc Thu Nov 12 01:21:29 2020 -0500 @@ -632,14 +632,23 @@ return; // First search in the function index +#if defined (HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER) + QList found_links + = m_help_engine->documentsForIdentifier (ref_name); + + QUrl first_url = found_links.constFirst().url; +#else QMap found_links = m_help_engine->linksForIdentifier (ref_name); - QTabWidget *navi = static_cast (widget (0)); + QUrl first_url = found_links.constBegin().value (); +#endif + + QTabWidget *navi = static_cast (widget (0)); if (found_links.count() > 0) { - m_doc_browser->setSource (found_links.constBegin().value()); + m_doc_browser->setSource (first_url); // Switch to function index tab m_help_engine->indexWidget()->filterIndices (ref_name); diff -r 6ecc75589cbc -r 0678fdb81efc m4/acinclude.m4 --- a/m4/acinclude.m4 Thu Nov 12 01:17:52 2020 -0500 +++ b/m4/acinclude.m4 Thu Nov 12 01:21:29 2020 -0500 @@ -830,6 +830,41 @@ fi ]) dnl +dnl Check whether the Qt class QHelpEngine has the documentsForIdentifier +dnl function. dnl This member function was introduced in Qt 5.15. +dnl +AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER], [ + AC_CACHE_CHECK([for QHelpEngine::documentsForIdentifier in ], + [octave_cv_func_qhelpengine_documentsforidentifier], + [AC_LANG_PUSH(C++) + ac_octave_save_CPPFLAGS="$CPPFLAGS" + ac_octave_save_CXXFLAGS="$CXXFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" + CXXFLAGS="$CXXPICFLAG $CXXFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + #include + #include + #include + #include + ]], [[ + QString collection_file; + QHelpEngine eng (collection_file); + QString id; + eng.documentsForIdentifier (id); + ]])], + octave_cv_func_qhelpengine_documentsforidentifier=yes, + octave_cv_func_qhelpengine_documentsforidentifier=no) + CPPFLAGS="$ac_octave_save_CPPFLAGS" + CXXFLAGS="$ac_octave_save_CXXFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_func_qhelpengine_documentsforidentifier = yes; then + AC_DEFINE(HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER, 1, + [Define to 1 if you have the `QHelpEngine::documentsForIdentifier' member function.]) + fi +]) +dnl dnl Check whether the Qt class QWheelEvent has the angleDelta member function. dnl This member function was introduced in Qt 5. dnl @@ -2464,6 +2499,7 @@ OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO OCTAVE_CHECK_FUNC_QTABWIDGET_SETMOVABLE OCTAVE_CHECK_FUNC_QTMESSAGEHANDLER_ACCEPTS_QMESSAGELOGCONTEXT + OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER OCTAVE_CHECK_FUNC_QWHEELEVENT_ANGLEDELTA OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION OCTAVE_CHECK_MEMBER_QFONT_FORCE_INTEGER_METRICS