Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoQtKeyboard.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : David Mott (MMM yyyy)
22** Modified by : Gavin Bell (MMM yyyy)
23**=======================================================================*/
24
25
26#ifndef _SO_QT_KEYBOARD_
27#define _SO_QT_KEYBOARD_
28#include <Inventor/Qt/OivQtCompat.h>
29#include <Inventor/Qt/devices/SoQtDevice.h>
30#include <Inventor/events/SoKeyboardEvent.h>
31
32class QKeyEvent;
33
34#define SO_QT_ALL_KEYBOARD_EVENTS (KeyPressMask | KeyReleaseMask)
35
55class SoQtKeyboard : public SoQtDevice {
56
57 Q_OBJECT
58
59 public:
72 SoQtKeyboard(EventMask mask = SO_QT_ALL_KEYBOARD_EVENTS);
77
79 virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void* unused=NULL);
80
82 virtual void disable(QWidget *w, XtEventHandler f, XtPointer data);
83
85 virtual const SoEvent * translateEvent(QEvent *event);
86
87 private:
88 EventMask eventMask; // Q event interest for this device
89 SoKeyboardEvent *keyEvent; // keyboard press or release
90 SoKeyboardEvent *translateKeyEvent(QKeyEvent *ke, SoButtonEvent::State s);
91
92 // Mapping from QT virtual keys to SoKeyboardEvent::Key enum
93 static SoKeyboardEvent::Key keyMap[256];
94 static SoKeyboardEvent::Key keyMap2[97];
95 static int keyMapInitFlag;
96
97
98};
99
100#endif /* _SO_QT_KEYBOARD_ */
101
102
Base class for all events.
Definition SoEvent.h:116
Keyboard key press and release events.
Key
The keyboard keys.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Definition SoQtDevice.h:102
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Translates and r...
SoQtKeyboard(EventMask mask=SO_QT_ALL_KEYBOARD_EVENTS)
Constructor.
virtual const SoEvent * translateEvent(QEvent *event)
Attempts to convert the passed event into an SoEvent.
virtual void disable(QWidget *w, XtEventHandler f, XtPointer data)
Disables the device for the passed widget.
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)
Enables the device for the passed widget.
~SoQtKeyboard()
Destructor.
void * XtPointer
Definition SoQtDef.h:122