Mercurial > octave
changeset 27842:e79999c5d782
fix Qt4 build errors (bug #57420)
* acinclude.m4 (OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT): New macro.
(OCTAVE_CHECK_QT_VERSION): Use it.
* find-dialog.cc (find_dialog::init_search_text): Provide replacement
for QComboBox::setCurrentText.
* octave-qscintilla.h: Include <QTemporaryFile> header.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 16 Dec 2019 01:47:18 -0500 |
parents | f68c7c56e5f2 |
children | 48c77d47ea81 |
files | libgui/src/m-editor/find-dialog.cc libgui/src/m-editor/octave-qscintilla.h m4/acinclude.m4 |
diffstat | 3 files changed, 47 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/find-dialog.cc Mon Dec 16 07:12:05 2019 +0100 +++ b/libgui/src/m-editor/find-dialog.cc Mon Dec 16 01:47:18 2019 -0500 @@ -380,7 +380,21 @@ int lbeg, lend, cbeg, cend; _edit_area->getSelection (&lbeg,&cbeg,&lend,&cend); if (lbeg == lend) +#if defined (HAVE_QCOMBOBOX_SETCURRENTTEXT) _search_line_edit->setCurrentText (_edit_area->selectedText ()); +#else + if (_search_line_edit->isEditable ()) + { + _search_line_edit->setEditText (_edit_area->selectedText ()); + } + else + { + int i = _search_line_edit->findText (_edit_area->selectedText ()); + + if (i > -1) + _search_line_edit->setCurrentIndex (i); + } +#endif } // set focus to "Find what" and select all text
--- a/libgui/src/m-editor/octave-qscintilla.h Mon Dec 16 07:12:05 2019 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.h Mon Dec 16 01:47:18 2019 -0500 @@ -30,6 +30,7 @@ #include <QLabel> #include <QMenu> #include <Qsci/qsciscintilla.h> +#include <QTemporaryFile> #include "gui-settings.h" #include "qt-interpreter-events.h"
--- a/m4/acinclude.m4 Mon Dec 16 07:12:05 2019 +0100 +++ b/m4/acinclude.m4 Mon Dec 16 01:47:18 2019 -0500 @@ -344,6 +344,37 @@ fi ]) dnl +dnl Check whether the Qt QComboBox class has the setCurrentText +dnl function. This function was introduced in Qt 5. +dnl +dnl FIXME: Delete this entirely when we drop support for Qt 4. +dnl +AC_DEFUN([OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT], [ + AC_CACHE_CHECK([for QComboBox::setCurrentText], + [octave_cv_func_qcombobox_setcurrenttext], + [AC_LANG_PUSH(C++) + ac_octave_save_CPPFLAGS="$CPPFLAGS" + ac_octave_save_CXXFLAGS="$CXXFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" + CXXFLAGS="$CXXPICFLAG $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QComboBox> + ]], [[ + QComboBox combo_box (nullptr); + combo_box.setCurrentText ("text"); + ]])], + octave_cv_func_qcombobox_setcurrenttext=yes, + octave_cv_func_qcombobox_setcurrenttext=no) + CPPFLAGS="$ac_octave_save_CPPFLAGS" + CXXFLAGS="$ac_octave_save_CXXFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_func_qcombobox_setcurrenttext = yes; then + AC_DEFINE(HAVE_QCOMBOBOX_SETCURRENTTEXT, 1, + [Define to 1 if you have the `QComboBox::setCurrentText' member function.]) + fi +]) +dnl dnl Check whether the Qt QGuiApplication class has the setDesktopFileName dnl static member function. This function was introduced in Qt 5.7. dnl @@ -2155,6 +2186,7 @@ ## tests if they fail because we have already decided that the Qt ## version that we are testing now will be the one used. + OCTAVE_CHECK_FUNC_QCOMBOBOX_SETCURRENTTEXT OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE