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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/toolx/Qt/glarea (Version 11.3.0) and /externals/g4tools/include/toolx/Qt/glarea (Version 6.0.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef toolx_Qt_glarea                           
  5 #define toolx_Qt_glarea                           
  6                                                   
  7 #include "../sg/GL_viewer"                        
  8                                                   
  9 #include <QtCore/qglobal.h> //For QT_VERSION.     
 10                                                   
 11 #if QT_VERSION < 0x060000                         
 12 #include <QtOpenGL/qgl.h>                         
 13 #else                                             
 14 #include <QtOpenGLWidgets/qopenglwidget.h>        
 15 #endif                                            
 16                                                   
 17 #include <QtGui/qevent.h>                         
 18                                                   
 19 #include <tools/sg/device_interactor>             
 20 #ifdef TOOLS_MEM                                  
 21 #include <tools/mem>                              
 22 #endif                                            
 23                                                   
 24 namespace toolx {                                 
 25 namespace Qt {                                    
 26                                                   
 27 class glarea                                      
 28 #if QT_VERSION < 0x060000                         
 29 :public QGLWidget                                 
 30 #else                                             
 31 :public QOpenGLWidget                             
 32 #endif                                            
 33 {                                                 
 34 #if QT_VERSION < 0x060000                         
 35   typedef QGLWidget parent;                       
 36 #else                                             
 37   using parent = QOpenGLWidget;                   
 38 #endif                                            
 39   TOOLS_SCLASS(toolx::Qt::glarea)                 
 40 public:                                           
 41   virtual void initializeGL() {}                  
 42   virtual void paintGL() {                        
 43 #if QT_VERSION < 0x050000                         
 44     m_viewer.set_size(width(),height());          
 45 #else                                             
 46     m_viewer.set_size(devicePixelRatio()*width    
 47 #endif                                            
 48     m_viewer.render();                            
 49   }                                               
 50                                                   
 51   virtual void keyPressEvent(QKeyEvent* a_even    
 52     if(!m_interactor) return;                     
 53     tools::sg::key_down_event _event(convert_k    
 54     m_interactor->key_press(_event);              
 55   }                                               
 56   virtual void keyReleaseEvent(QKeyEvent* a_ev    
 57     if(!m_interactor) return;                     
 58     tools::sg::key_up_event _event(convert_key    
 59     m_interactor->key_release(_event);            
 60   }                                               
 61   virtual void mousePressEvent(QMouseEvent* a_    
 62     if(!m_interactor) return;                     
 63 #if QT_VERSION < 0x060000                         
 64     tools::sg::mouse_down_event _event(a_event    
 65 #else                                             
 66     tools::sg::mouse_down_event _event(a_event    
 67 #endif                                            
 68     m_interactor->mouse_press(_event);            
 69   }                                               
 70   virtual void mouseReleaseEvent(QMouseEvent*     
 71     if(!m_interactor) return;                     
 72 #if QT_VERSION < 0x060000                         
 73     tools::sg::mouse_up_event _event(a_event->    
 74 #else                                             
 75     tools::sg::mouse_up_event _event(a_event->    
 76 #endif                                            
 77     m_interactor->mouse_release(_event);          
 78   }                                               
 79   virtual void mouseMoveEvent(QMouseEvent* a_e    
 80     if(!m_interactor) return;                     
 81 #if QT_VERSION < 0x060000                         
 82     tools::sg::mouse_move_event _event(a_event    
 83 #else                                             
 84     tools::sg::mouse_move_event _event(a_event    
 85 #endif                                            
 86     m_interactor->mouse_move(_event);             
 87   }                                               
 88   virtual void wheelEvent(QWheelEvent* a_event    
 89     if(!m_interactor) return;                     
 90     tools::sg::wheel_rotate_event _event(a_eve    
 91     m_interactor->wheel_rotate(_event);           
 92   }                                               
 93                                                   
 94 public:                                           
 95   glarea(QWidget* a_parent,toolx::sg::GL_viewe    
 96 #ifdef TOOLS_MEM                                  
 97     tools::mem::increment(s_class().c_str());     
 98 #endif                                            
 99   }                                               
100   virtual ~glarea(){                              
101 #ifdef TOOLS_MEM                                  
102     tools::mem::decrement(s_class().c_str());     
103 #endif                                            
104   }                                               
105 public:                                           
106   void set_device_interactor(tools::sg::device    
107 protected:                                        
108   tools::key_code convert_key(/*Qt::Key*/int a    
109 protected:                                        
110   toolx::sg::GL_viewer& m_viewer;                 
111   tools::sg::device_interactor* m_interactor;     
112 };                                                
113                                                   
114 }}                                                
115                                                   
116                                                   
117 #endif