[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assistance wanted for Qt ginput() bug #44832
From: |
Daniel J Sebald |
Subject: |
Re: Assistance wanted for Qt ginput() bug #44832 |
Date: |
Fri, 19 Jun 2015 16:20:49 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 06/19/2015 03:11 PM, Philip Nienhuis wrote:
As adviced by Rik I'm asking here for some assistance with bug #44832:
ginput() only recognizes key pressed after a first mouse click.
Apparently the Canvas must be made an active object as soon as a figure is
made active, and not only after it was clicked; but it is unclear how to do
that.
It sounds like pressing the mouse button causes the QGraphicsScene/View
to come in focus. You'll have to figure out how to directly make that
graphics scene or view the active window so that key events going to the
container window are propagated to the canvas. It looks likes the
hierarchy goes back to QWidget:
GLCanvas::keyPressEvent (QKeyEvent* xevent)
class GLCanvas : public QGLWidget, public Canvas
class Q_OPENGL_EXPORT QGLWidget : public QWidget
So you may be able to make the canvas the active window with:
http://doc.qt.io/qt-4.8/qwidget.html#activateWindow
if somewhere in construction there is pointer access to it. E.g.,
canvaspointer->activateWindow ();
The only concern would be that something else within the container
window is initially the active window (some button, some toolbar, etc.)
and whether there is some way through user action that could be made
active again such that the canvas loses focus again somehow. Another
approach would be to rewrite the keyPressEvent of the container class so
that it always redirects the event to the canvas. In theory
straightforward, just perhaps a little confusing to follow given
GLCanvas is derived from two classes.
Some related info:
http://doc.qt.io/qt-4.8/qgraphicsscene.html#focusInEvent
http://doc.qt.io/qt-4.8/qgraphicsscene.html#focusInEvent
http://doc.qt.io/qt-4.8/qgraphicsview.html#focusInEvent
http://doc.qt.io/qt-4.8/qwidget.html#keyPressEvent
Dan
Thanks,
Philip
--
View this message in context:
http://octave.1599824.n4.nabble.com/Assistance-wanted-for-Qt-ginput-bug-44832-tp4671063.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
--
Dan Sebald
email: daniel(DOT)sebald(AT)ieee(DOT)org
URL: http://www(DOT)dansebald(DOT)com