I begin with a Qt/OpenGL application. I have a first QMainWindow which contains a GLWidget subclass ("widget_2") of QGLWidget. This GLWidget renders a graphics animation.
From the menu of this QMainWindow, I call a second QMainWindow where I set parameters for the animation of widget_2.
Every works fine except the focus. I would like to have the focus which follows mouse when I move the mouse from a QWindow to another.
I try to use widget_2->setMouseTracking(true) in the constructor of the first QMainWindow but the problem is that I do rotations with mouse on widget_2. So I have overloaded mouseEvent on widget_2 object this way to avoid conflicts between rotations and mouse tracking :
Qt Code:
{ if (event->buttons() & Qt::LeftButton) { yrot = (event->x() - xdiff) / 10.0f; xrot = (event->y() + ydiff) / 10.0f; } else { event->ignore(); } }To copy to clipboard, switch view to plain text mode
Currently, when I am on the second QMainWindow and I load the parameters and then I move to the first one, I have still to click on widget_2 GLWidget before being able to do rotations and to press the pushButtons.
I would like the focus to follow mouse, i.e when I am over widget_2, focus is on widget_2 without having to click to do rotations, and when I am over the menu, I don't need to click twice to push buttons.
I am on Debian GNU/Linux 6.0.
Any help would be great
Bookmarks