44#define _OcctQtTools_HeaderFile
55
66#include < Aspect_WindowInputListener.hxx>
7- #include < Quantity_Color .hxx>
7+ #include < Quantity_ColorRGBA .hxx>
88
99#include < Standard_WarningsDisable.hxx>
1010#include < QColor>
@@ -16,55 +16,79 @@ class OpenGl_Caps;
1616class V3d_View ;
1717
1818// ! Auxiliary tools between Qt and OCCT definitions.
19- namespace OcctQtTools
19+ class OcctQtTools
2020{
21- // ! Perform global Qt platform setup - to be called before QApplication creation.
22- // ! Defines platform plugin to load (e.g. xcb on Linux)
23- // ! and graphic driver (e.g. desktop OpenGL with desired profile/surface).
24- void qtGlPlatformSetup ();
21+ public: // ! @name Qt application pre-setup for OCCT 3D Viewer integration
2522
26- // ! Return default Qt surface format for GL context.
27- QSurfaceFormat qtGlSurfaceFormat (QSurfaceFormat::OpenGLContextProfile theProfile = QSurfaceFormat::NoProfile,
28- bool theToDebug = false );
23+ // ! Perform global Qt platform setup - to be called before QApplication creation.
24+ // ! Defines platform plugin to load (e.g. xcb on Linux)
25+ // ! and graphic driver (e.g. desktop OpenGL with desired profile/surface).
26+ static void qtGlPlatformSetup ();
2927
30- // ! Fill in OCCT GL caps from Qt surface format.
31- void qtGlCapsFromSurfaceFormat (OpenGl_Caps& theCaps, const QSurfaceFormat& theFormat);
28+ // ! Define default Qt surface format for GL context.
29+ static QSurfaceFormat qtGlSurfaceFormat (QSurfaceFormat::OpenGLContextProfile theProfile = QSurfaceFormat::NoProfile,
30+ bool theToDebug = false );
3231
33- // ! Map QColor into Quantity_Color .
34- Quantity_Color qtColorToOcct ( const QColor& theColor );
32+ // ! Fill in OCCT GL caps from Qt surface format .
33+ static void qtGlCapsFromSurfaceFormat (OpenGl_Caps& theCaps, const QSurfaceFormat& theFormat );
3534
36- // ! Map Quantity_Color into QColor.
37- QColor qtColorFromOcct (const Quantity_Color& theColor);
35+ public: // ! @name common conversion tools
3836
39- // ! Map Qt buttons bitmask to virtual keys .
40- Aspect_VKeyMouse qtMouseButtons2VKeys (Qt::MouseButtons theButtons );
37+ // ! Map QColor into Quantity_Color .
38+ static Quantity_Color qtColorToOcct ( const QColor& theColor );
4139
42- // ! Map Qt mouse modifiers bitmask to virtual keys .
43- Aspect_VKeyFlags qtMouseModifiers2VKeys (Qt::KeyboardModifiers theModifiers );
40+ // ! Map Quantity_Color into QColor .
41+ static QColor qtColorFromOcct ( const Quantity_Color& theColor );
4442
45- // ! Map Qt key to virtual key .
46- Aspect_VKey qtKey2VKey ( int theKey );
43+ // ! Map QColor into Quantity_ColorRGBA .
44+ static Quantity_ColorRGBA qtColorToOcctRgba ( const QColor& theColor );
4745
48- // ! Queue Qt mouse hover event to OCCT listener.
49- bool qtHandleHoverEvent (Aspect_WindowInputListener& theListener,
50- const Handle (V3d_View)& theView,
51- const QHoverEvent* theEvent);
46+ // ! Map Quantity_ColorRGBA into QColor.
47+ static QColor qtColorFromOcctRgba (const Quantity_ColorRGBA& theColor);
5248
53- // ! Queue Qt mouse event to OCCT listener.
54- bool qtHandleMouseEvent (Aspect_WindowInputListener& theListener,
55- const Handle (V3d_View)& theView,
56- const QMouseEvent* theEvent);
49+ // ! Map QString into TCollection_AsciiString (UTF-8).
50+ static TCollection_AsciiString qtStringToOcct (const QString& theText);
5751
58- // ! Queue Qt mouse wheel event to OCCT listener.
59- bool qtHandleWheelEvent (Aspect_WindowInputListener& theListener,
60- const Handle (V3d_View)& theView,
61- const QWheelEvent* theEvent);
52+ // ! Map TCollection_AsciiString (UTF-8) into QString.
53+ static QString qtStringFromOcct (const TCollection_AsciiString& theText);
6254
63- // ! Queue Qt touch event to OCCT listener.
64- bool qtHandleTouchEvent (Aspect_WindowInputListener& theListener,
65- const Handle (V3d_View)& theView,
66- const QTouchEvent* theEvent);
55+ // ! Map QString into TCollection_ExtendedString (UTF-16).
56+ static TCollection_ExtendedString qtStringToOcctExt (const QString& theText);
6757
68- } // namespace OcctQtTools
58+ // ! Map TCollection_ExtendedString (UTF-16) into QString.
59+ static QString qtStringFromOcctExt (const TCollection_ExtendedString& theText);
60+
61+ public: // ! @name methods for wrapping Qt input events into Aspect_WindowInputListener events
62+
63+ // ! Queue Qt mouse hover event to OCCT listener.
64+ static bool qtHandleHoverEvent (Aspect_WindowInputListener& theListener,
65+ const Handle (V3d_View)& theView,
66+ const QHoverEvent* theEvent);
67+
68+ // ! Queue Qt mouse event to OCCT listener.
69+ static bool qtHandleMouseEvent (Aspect_WindowInputListener& theListener,
70+ const Handle (V3d_View)& theView,
71+ const QMouseEvent* theEvent);
72+
73+ // ! Queue Qt mouse wheel event to OCCT listener.
74+ static bool qtHandleWheelEvent (Aspect_WindowInputListener& theListener,
75+ const Handle (V3d_View)& theView,
76+ const QWheelEvent* theEvent);
77+
78+ // ! Queue Qt touch event to OCCT listener.
79+ static bool qtHandleTouchEvent (Aspect_WindowInputListener& theListener,
80+ const Handle (V3d_View)& theView,
81+ const QTouchEvent* theEvent);
82+
83+ // ! Map Qt buttons bitmask to virtual keys.
84+ static Aspect_VKeyMouse qtMouseButtons2VKeys (Qt::MouseButtons theButtons);
85+
86+ // ! Map Qt mouse modifiers bitmask to virtual keys.
87+ static Aspect_VKeyFlags qtMouseModifiers2VKeys (Qt::KeyboardModifiers theModifiers);
88+
89+ // ! Map Qt key to virtual key.
90+ static Aspect_VKey qtKey2VKey (int theKey);
91+
92+ };
6993
7094#endif // _OcctQtTools_HeaderFile
0 commit comments