Mercurial > octave
diff libgui/graphics/QtHandlesUtils.cc @ 27215:274766cae722
allow building with Qt4 to work again
* acinclude.m4 (OCTAVE_CHECK_FUNC_QWHEELEVENT_ANGLEDELTA): New macro.
(OCTAVE_CHECK_QT_VERSION): Use it.
* QtHandlesUtils.cc (makeScrollEventStruct): Work with both Qt4 and Qt5.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 26 Jun 2019 12:09:37 -0400 |
parents | bf2f533d2d45 |
children | 718116e9c7d3 |
line wrap: on
line diff
--- a/libgui/graphics/QtHandlesUtils.cc Tue Apr 02 12:00:29 2019 +0000 +++ b/libgui/graphics/QtHandlesUtils.cc Wed Jun 26 12:09:37 2019 -0400 @@ -391,8 +391,14 @@ // We assume a standard mouse with 15 degree steps and Qt returns // 1/8 of a degree. - retval.setfield ("VerticalScrollCount", - octave_value (- event->angleDelta().y () / 120)); +#if defined (HAVE_QWHEELEVENT_ANGLEDELTA) + int ydelta = -(event->angleDelta().y ()); +#else + int ydelta = (event->orientation () == Qt::Vertical + ? -(event->delta ()) : 0); +#endif + retval.setfield ("VerticalScrollCount", octave_value (ydelta / 120)); + // FIXME: Is there any way to access the number of lines a scroll step // should correspond to? retval.setfield ("VerticalScrollAmount", octave_value (3));