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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/pixwin (Version 11.3.0) and /externals/g4tools/include/toolx/Qt/pixwin (Version 6.0)


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