I have created a simple test application using Qt to test the SpaceNavigator. I have a main window that contains 2 widgets.
Upon receiving a QEvent::Enter, I call MagellanSetWindow with the second widget's window id.
Upon receiving a QEvent::Leave, I call MagellanSetWindow with InputFocus.
However, when my application receives the Magellan events, it always sends them to my application's main window, not to the second widget.
Is this the correct behaviour?
Events received by main window
Moderator: Moderators
Hi spacenavdev,
I'm not very familiar with Qt, so please correct me if I'm wrong.
From what I've read QMainWindow (inherits QWidget) and QWidget both can receive/generate QEvents.
So if you enter (QEvent::Enter) your window you set the 2nd-QWidget's window id (QMainWindow?), which is now the receiver of the Magellan events.
If you now move (within the QMainWindow) to one of the both contained QWidgets the same thing happens again, correct?
In both cases your QMainWindow is/should be the receiver, which is just perfect.
If you leave one of the two QWidgets (QEvent::Leave) you call MagellanSetWindow() with InputFocus, which is still your QMainWindow since you're still within the window. So that behaviour is correct.
If you further leave your QMainWindow (again QEvent::Leave) and thus call MagellanSetWindow() with InputFocus again, the events should not be sent to your QMainWindow any longer, but to the window that has the new InputFocus.
Hope I could help!
Christian Robl
3Dconnexion
I'm not very familiar with Qt, so please correct me if I'm wrong.
From what I've read QMainWindow (inherits QWidget) and QWidget both can receive/generate QEvents.
So if you enter (QEvent::Enter) your window you set the 2nd-QWidget's window id (QMainWindow?), which is now the receiver of the Magellan events.
If you now move (within the QMainWindow) to one of the both contained QWidgets the same thing happens again, correct?
In both cases your QMainWindow is/should be the receiver, which is just perfect.
If you leave one of the two QWidgets (QEvent::Leave) you call MagellanSetWindow() with InputFocus, which is still your QMainWindow since you're still within the window. So that behaviour is correct.
If you further leave your QMainWindow (again QEvent::Leave) and thus call MagellanSetWindow() with InputFocus again, the events should not be sent to your QMainWindow any longer, but to the window that has the new InputFocus.
Hope I could help!
Christian Robl
3Dconnexion
-
- Posts: 4
- Joined: Mon Aug 13, 2007 1:23 pm
I was expecting the events to be sent to the 2nd QWidget itself (as I was sending the QWidget's own id to MagellanSetWindow), not the containing QMainWindow. In other words, I was expecting it to work the same way as for normal keyboard or mouse events, which are sent directly to the 2nd QWidget itself.
However, it seems that the events are sent to the containing window, not the widget, so I have come up with a workaround.
However, it seems that the events are sent to the containing window, not the widget, so I have come up with a workaround.
Hi spacenavdev,
maybe its because our events are XClientMessages and Qt processes them this way.
Anyway. I think a workaround (propagate certain QEvents down to a child ) isn't that difficult in Qt, is it?
Good luck!
Christian Robl
3Dconnexion
maybe its because our events are XClientMessages and Qt processes them this way.
Anyway. I think a workaround (propagate certain QEvents down to a child ) isn't that difficult in Qt, is it?
Good luck!
Christian Robl
3Dconnexion