g4tools  5.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::Qt::glarea Class Reference
Inheritance diagram for tools::Qt::glarea:
Inheritance graph
[legend]
Collaboration diagram for tools::Qt::glarea:
Collaboration graph
[legend]

Public Member Functions

virtual void initialieGL ()
 
virtual void resizeGL (int a_w, int a_h)
 
virtual void paintGL ()
 
virtual void keyPressEvent (QKeyEvent *a_event)
 
virtual void keyReleaseEvent (QKeyEvent *a_event)
 
virtual void mousePressEvent (QMouseEvent *a_event)
 
virtual void mouseReleaseEvent (QMouseEvent *a_event)
 
virtual void mouseMoveEvent (QMouseEvent *a_event)
 
virtual void wheelEvent (QWheelEvent *a_event)
 
 glarea (QWidget *a_parent, tools::sg::GL_viewer &a_viewer)
 
virtual ~glarea ()
 
void set_device_interactor (tools::sg::device_interactor *a_interactor)
 

Protected Member Functions

tools::key_code convert (int a_key)
 

Protected Attributes

tools::sg::GL_viewerm_viewer
 
tools::sg::device_interactorm_interactor
 

Detailed Description

Definition at line 17 of file glarea.

Constructor & Destructor Documentation

◆ glarea()

tools::Qt::glarea::glarea ( QWidget *  a_parent,
tools::sg::GL_viewer a_viewer 
)
inline

Definition at line 78 of file glarea.

78 :parent(a_parent),m_viewer(a_viewer),m_interactor(0){}

◆ ~glarea()

virtual tools::Qt::glarea::~glarea ( )
inlinevirtual

Definition at line 79 of file glarea.

79 {}

Member Function Documentation

◆ convert()

tools::key_code tools::Qt::glarea::convert ( int  a_key)
inlineprotected

Definition at line 83 of file glarea.

83 {return a_key;}

◆ initialieGL()

virtual void tools::Qt::glarea::initialieGL ( )
inlinevirtual

Definition at line 20 of file glarea.

20 {}

◆ keyPressEvent()

virtual void tools::Qt::glarea::keyPressEvent ( QKeyEvent *  a_event)
inlinevirtual

Definition at line 41 of file glarea.

41  {
42  if(!m_interactor) return;
43  tools::sg::key_down_event event(convert(a_event->key()));
44  m_interactor->key_press(event);
45  }

◆ keyReleaseEvent()

virtual void tools::Qt::glarea::keyReleaseEvent ( QKeyEvent *  a_event)
inlinevirtual

Definition at line 46 of file glarea.

46  {
47  if(!m_interactor) return;
48  tools::sg::key_up_event event(convert(a_event->key()));
49  m_interactor->key_release(event);
50  }

◆ mouseMoveEvent()

virtual void tools::Qt::glarea::mouseMoveEvent ( QMouseEvent *  a_event)
inlinevirtual

Definition at line 61 of file glarea.

61  {
62  if(!m_interactor) return;
63  tools::sg::mouse_move_event event(a_event->x(),a_event->y(),0,0,false);
64  m_interactor->mouse_move(event);
65  }

◆ mousePressEvent()

virtual void tools::Qt::glarea::mousePressEvent ( QMouseEvent *  a_event)
inlinevirtual

Definition at line 51 of file glarea.

51  {
52  if(!m_interactor) return;
53  tools::sg::mouse_down_event event(a_event->x(),a_event->y());
54  m_interactor->mouse_press(event);
55  }

◆ mouseReleaseEvent()

virtual void tools::Qt::glarea::mouseReleaseEvent ( QMouseEvent *  a_event)
inlinevirtual

Definition at line 56 of file glarea.

56  {
57  if(!m_interactor) return;
58  tools::sg::mouse_up_event event(a_event->x(),a_event->y());
60  }

◆ paintGL()

virtual void tools::Qt::glarea::paintGL ( )
inlinevirtual

Definition at line 30 of file glarea.

30  {
31 #if QT_VERSION < 0x050000
32  //::printf("debug : tools::Qt::glarea::paintGL %d %d\n",width(),height());
33  m_viewer.set_size(width(),height());
34 #else
35  //::printf("debug : tools::Qt::glarea::paintGL %d %d\n",m_width,m_height);
36  m_viewer.set_size(m_width,m_height);
37 #endif
38  m_viewer.render();
39  }

◆ resizeGL()

virtual void tools::Qt::glarea::resizeGL ( int  a_w,
int  a_h 
)
inlinevirtual

Definition at line 21 of file glarea.

21  {
22  //::printf("debug : resize : %d %d\n",a_w,a_h);
23 #if QT_VERSION < 0x050000
24 #else
25  m_width = a_w;
26  m_height = a_h;
27 #endif
28  }

◆ set_device_interactor()

void tools::Qt::glarea::set_device_interactor ( tools::sg::device_interactor a_interactor)
inline

Definition at line 81 of file glarea.

81 {m_interactor = a_interactor;} //we do not have ownership.

◆ wheelEvent()

virtual void tools::Qt::glarea::wheelEvent ( QWheelEvent *  a_event)
inlinevirtual

Definition at line 71 of file glarea.

71  {
72  if(!m_interactor) return;
73  tools::sg::wheel_rotate_event event(a_event->angleDelta().y());
74  m_interactor->wheel_rotate(event);
75  }

Member Data Documentation

◆ m_interactor

tools::sg::device_interactor* tools::Qt::glarea::m_interactor
protected

Definition at line 92 of file glarea.

◆ m_viewer

tools::sg::GL_viewer& tools::Qt::glarea::m_viewer
protected

Definition at line 85 of file glarea.


The documentation for this class was generated from the following file:
tools::sg::key_up_event
Definition: event:350
tools::sg::device_interactor::wheel_rotate
virtual void wheel_rotate(const wheel_rotate_event &)=0
tools::sg::device_interactor::key_press
virtual void key_press(const key_down_event &)=0
tools::sg::viewer::set_size
virtual void set_size(unsigned int a_w, unsigned int a_h)
Definition: viewer:26
tools::sg::key_down_event
Definition: event:312
tools::sg::mouse_up_event
Definition: event:150
tools::sg::device_interactor::mouse_press
virtual void mouse_press(const mouse_down_event &)=0
tools::Qt::glarea::m_viewer
tools::sg::GL_viewer & m_viewer
Definition: glarea:85
tools::sg::mouse_down_event
Definition: event:107
tools::Qt::glarea::m_interactor
tools::sg::device_interactor * m_interactor
Definition: glarea:92
tools::Qt::glarea::convert
tools::key_code convert(int a_key)
Definition: glarea:83
tools::sg::mouse_move_event
Definition: event:193
tools::sg::device_interactor::mouse_release
virtual void mouse_release(const mouse_up_event &)=0
tools::sg::wheel_rotate_event
Definition: event:388
tools::sg::device_interactor::mouse_move
virtual void mouse_move(const mouse_move_event &)=0
tools::sg::GL_viewer::render
void render()
Definition: GL_viewer:18
tools::sg::device_interactor::key_release
virtual void key_release(const key_up_event &)=0