[Interest] SpaceNavigator 3D input device support
Christian Gagneraud
chgans at gna.org
Wed Apr 8 04:19:29 CEST 2015
On 07/04/15 19:44, Boudewijn Rempt wrote:
> On Tue, 7 Apr 2015, Christian Gagneraud wrote:
>
>> Hi there,
>>
>> Is anyone aware of a Qt based lib that would provide support for devices
>> like the SpaceNavigator? [1]
>>
>> I'm aware of at least one Qt based app (FreeCAD [2]) that works on
>> Linux, OS X and Windows and which has support for this device. I had a
>> look at the source code, it is not that complicated [3], but there's lot
>> of boilerplate for multi-platform support.
>>
>> So i just wondered if someone out there has a nice Qt lib that is easy
>> to integrate into existing projects or even better a Qt input plugin?
>>
>
> Hm, the space navigator support code in Calligra doesn't have any
> platform boilerplate, but whether that means it works on Windows, I
> don't know -- all our space navigators have disappeared in the mists of
> time.
Hi Boudewijn,
I just had a look at the source code, and indeed, Calligra rely solely
on libspacenav [1] which AFAIU is *not* multi platform.
Quick comparison between FreeCAD and Calligra:
- Calligra use only libspnav, Freecad can use either proprietary SDK
(Windows and Mac) or libspnav (X11)
- Calligra use a polling thread, which communicate with the main
thread through signal/slots, the receiver then calls some custom event
handler of a KoToolBase class instance. FreeCAD uses raw event filtering
on QApp instance and calls postEvent() on focusWidget()
- Freecad have some logic to manage event accumulation, flooding and
flushing (didn't quite understand why and how)
- Freecad as a built-in "calibrate" feature (not sure how this works)
- Calligra uses the 2 Space navigator buttons as if they were the
mouse left/right buttons, Freecad defines them as 2 new sort of buttons
- Calligra interpret the events as position/rotation, FreeCAD as
translation/rotation, not sure if it's just semantics here. (libspnav
uses translation/rotation)
- Device support in Calligra is done by a KoInputDeviceHandler plugin,
FreeCAD doesn't use the plugin approach.
- And last thing, FreeCAD has a nice device configuration Widget,
Calligra relies on the system/user configuration of the spacenavd
daemon. spnavcfg is the command that provides a GUI with even more
controls than what FreeCAD provides.
Both approaches have pros and cons.
Side note: On ubuntu, only 3 stock apps depends on libspnav0: freecad,
calligra and blender:
$ apt-cache rdepends libspnav0
libspnav0
Reverse Depends:
libspnav0:i386
libspnav-dev
freecad
calligra-libs
blender
Googling or DuckDuckGoing reveals more 3D related projects (Qt based or
not) that supports such as OpenSceneGraph, GoogleEarth, Ogre, ... (Not
counting professional CAD/EDA Software)
I think it would be very nice if Qt had support for this kind of input
device. Qt already provides key, mouse, native gesture, tablet and touch
input events.
Chris
>
>
>> Thx,
>> Chris
>>
>> [1] http://www.3dconnexion.eu/products/spacemouse/spacenavigator.html
>> [2]
>> http://www.freecadweb.org/wiki/index.php?title=3Dconnexion_input_devices
>> [3]
>> https://github.com/FreeCAD/FreeCAD_sf_master/blob/master/src/Gui/GuiApplicationNativeEventAware.h
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
More information about the Interest
mailing list