Mercurial > octave
diff libgui/graphics/Panel.cc @ 27224:9b8903d3e626
Allow figure "keypressfcn" to work with uipanel on the way (bug #56598)
* Panel.cc (Panel::Panel): Make sure the canvas listens to key events when the
parent figure has non empty "key*fcn" properties.
* Figure.cc (Figure::update): Look for uipanel children objects and update their
canvas key event mask when the "key*fcn" are changed.
* Canvas.cc (Canvas::canvasKeyPressEvent, Canvas::canvasKeyReleaseEvent):
Use the handle of the ancestor figure to post changes since the m_handle may
a handle to a uipanel.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Tue, 09 Jul 2019 19:41:27 +0200 |
parents | 92ecc4a97b5c |
children | 07b330708e3c |
line wrap: on
line diff
--- a/libgui/graphics/Panel.cc Thu Jul 04 21:14:09 2019 +0200 +++ b/libgui/graphics/Panel.cc Tue Jul 09 19:41:27 2019 +0200 @@ -138,6 +138,13 @@ frame->installEventFilter (this); m_container->installEventFilter (this); + + graphics_object fig (go.get_ancestor ("figure")); + if (! fig.get ("keypressfcn").isempty ()) + m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress); + + if (! fig.get ("keyreleasefcn").isempty ()) + m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease); if (pp.is_visible ()) QTimer::singleShot (0, frame, SLOT (show (void)));