Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 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 /visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc (Version 10.1.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4OpenGLImmediateQtViewer.cc 87164 2014-11-26 08:48:31Z gcosmo $
 27 //                                                 28 //
 28 //                                                 29 //
 29 // Class G4OpenGLImmediateQtViewer : a class d     30 // Class G4OpenGLImmediateQtViewer : a class derived from G4OpenGLQtViewer and
 30 //                                G4OpenGLImme     31 //                                G4OpenGLImmediateViewer.
 31                                                    32 
                                                   >>  33 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
                                                   >>  34 
 32 #include "G4OpenGLImmediateQtViewer.hh"            35 #include "G4OpenGLImmediateQtViewer.hh"
 33 #include "G4OpenGLImmediateSceneHandler.hh"        36 #include "G4OpenGLImmediateSceneHandler.hh"
 34                                                    37 
 35 #include "G4ios.hh"                                38 #include "G4ios.hh"
                                                   >>  39 #ifdef G4MULTITHREADED
 36 #include "G4Threading.hh"                          40 #include "G4Threading.hh"
                                                   >>  41 #endif
 37 #include <qapplication.h>                          42 #include <qapplication.h>
 38 #include <qtabwidget.h>                        <<  43 #include <qevent.h>
 39 #if 0x060000 <= QT_VERSION                     <<  44 
 40 #include "G4Qt.hh"                             <<  45 #ifdef G4OPENGL_VERSION_2
                                                   >>  46 #include <qglshaderprogram.h>
 41 #endif                                             47 #endif
 42                                                    48 
                                                   >>  49 
 43 G4OpenGLImmediateQtViewer::G4OpenGLImmediateQt     50 G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
 44 (G4OpenGLImmediateSceneHandler& sceneHandler,      51 (G4OpenGLImmediateSceneHandler& sceneHandler,
 45  const G4String&  name):                           52  const G4String&  name):
 46   G4VViewer (sceneHandler, sceneHandler.Increm     53   G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
 47   G4OpenGLViewer (sceneHandler),                   54   G4OpenGLViewer (sceneHandler),
 48   G4OpenGLQtViewer (sceneHandler),                 55   G4OpenGLQtViewer (sceneHandler),
 49   G4OpenGLImmediateViewer (sceneHandler)           56   G4OpenGLImmediateViewer (sceneHandler)
 50 {                                                  57 {
 51 #if QT_VERSION < 0x060000                      << 
 52   fQGLWidgetInitialiseCompleted = false;       << 
 53                                                    58 
 54   setFocusPolicy(Qt::StrongFocus); // enable k     59   setFocusPolicy(Qt::StrongFocus); // enable keybord events
 55   fHasToRepaint = false;                           60   fHasToRepaint = false;
 56   fPaintEventLock = false;                         61   fPaintEventLock = false;
 57   fUpdateGLLock = false;                       << 
 58                                                    62 
 59   if (fViewId < 0) return;  // In case error i <<  63   // Create a new drawer
 60 #else                                          <<  64   // register the QtDrawer to the OpenGLViewer
 61   setFocusPolicy(Qt::StrongFocus); // enable k <<  65 #ifdef G4OPENGL_VERSION_2
                                                   >>  66   setVboDrawer(new G4OpenGLVboDrawer(this,"OGL-VBO"));
 62 #endif                                             67 #endif
                                                   >>  68   
                                                   >>  69   resize(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
                                                   >>  70 
                                                   >>  71   if (fViewId < 0) return;  // In case error in base class instantiation.
 63 }                                                  72 }
 64                                                    73 
 65 G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQ <<  74 G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
                                                   >>  75   makeCurrent();
                                                   >>  76 }
 66                                                    77 
 67 void G4OpenGLImmediateQtViewer::Initialise() {     78 void G4OpenGLImmediateQtViewer::Initialise() {
 68 #if QT_VERSION < 0x060000                      <<  79 #ifdef G4DEBUG_VIS_OGL
 69                                                <<  80   printf("G4OpenGLImmediateQtViewer::Initialise \n");
                                                   >>  81 #endif
 70   fQGLWidgetInitialiseCompleted = false;           82   fQGLWidgetInitialiseCompleted = false;
 71   CreateMainWindow (this,QString(GetName()));      83   CreateMainWindow (this,QString(GetName()));
                                                   >>  84   CreateFontLists ();
 72                                                    85 
 73   makeCurrent();                               << 
 74   glDrawBuffer (GL_BACK);                      << 
 75                                                << 
 76   // set the good tab active                   << 
 77   if (G4QGLWidgetType::parentWidget()) {       << 
 78     auto *parentTab = dynamic_cast<QTabWidget* << 
 79     if (parentTab) {                           << 
 80       parentTab->setCurrentIndex(parentTab->co << 
 81     }                                          << 
 82   }                                            << 
 83                                                << 
 84   fQGLWidgetInitialiseCompleted = true;            86   fQGLWidgetInitialiseCompleted = true;
 85 #else                                          << 
 86   CreateMainWindow (this,QString(GetName()));  << 
 87   // Set jpg as default export format for Qt v << 
 88   setExportImageFormat("jpg");                 << 
 89 #endif                                         << 
 90 }                                                  87 }
 91                                                    88 
 92 #if QT_VERSION < 0x060000                      << 
 93 void G4OpenGLImmediateQtViewer::initializeGL (     89 void G4OpenGLImmediateQtViewer::initializeGL () {
 94                                                    90 
                                                   >>  91 #ifndef G4OPENGL_VERSION_2
 95   InitializeGLView ();                             92   InitializeGLView ();
                                                   >>  93 #else
                                                   >>  94     QGLShaderProgram *aQGLShaderProgram = new QGLShaderProgram (context());
                                                   >>  95     fShaderProgram = aQGLShaderProgram->programId ();
                                                   >>  96     
                                                   >>  97     aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Vertex,
                                                   >>  98                                                fVboDrawer->getVertexShaderSrc());
                                                   >>  99   
                                                   >> 100     aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Fragment,
                                                   >> 101                                                fVboDrawer->getFragmentShaderSrc());
                                                   >> 102 
                                                   >> 103     aQGLShaderProgram->link();
                                                   >> 104     aQGLShaderProgram->bind();
                                                   >> 105     
                                                   >> 106     fVertexPositionAttribute =  glGetAttribLocation(fShaderProgram, "aVertexPosition");
                                                   >> 107     fcMatrixUniform =  glGetUniformLocation(fShaderProgram, "uCMatrix");
                                                   >> 108     fpMatrixUniform =  glGetUniformLocation(fShaderProgram, "uPMatrix");
                                                   >> 109     ftMatrixUniform =  glGetUniformLocation(fShaderProgram, "uTMatrix");
                                                   >> 110     fmvMatrixUniform = glGetUniformLocation(fShaderProgram, "uMVMatrix");
                                                   >> 111   
                                                   >> 112   // Load identity at beginning
                                                   >> 113   float identity[16] = {
                                                   >> 114     1.0f, 0, 0, 0,
                                                   >> 115     0, 1.0f, 0, 0,
                                                   >> 116     0, 0, 1.0f, 0,
                                                   >> 117     0, 0, 0, 1.0f
                                                   >> 118   };
                                                   >> 119   glUniformMatrix4fv (fcMatrixUniform, 1, 0, identity);
                                                   >> 120   glUniformMatrix4fv (fpMatrixUniform, 1, 0, identity);
                                                   >> 121   glUniformMatrix4fv (ftMatrixUniform, 1, 0, identity);
                                                   >> 122   glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
                                                   >> 123 
                                                   >> 124   glUseProgram(fShaderProgram);
                                                   >> 125 
                                                   >> 126   setInitialized();  // Should be removed when fuse Wt and Qt
                                                   >> 127 
                                                   >> 128 #endif
 96                                                   129 
 97   // If a double buffer context has been force    130   // If a double buffer context has been forced upon us, ignore the
 98   // back buffer for this OpenGLImmediate view    131   // back buffer for this OpenGLImmediate view.
 99   //  glDrawBuffer (GL_FRONT); // FIXME : Ne m    132   //  glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
100                                                   133 
101   if (fSceneHandler.GetScene() == 0) {            134   if (fSceneHandler.GetScene() == 0) {
102     fHasToRepaint =false;                         135     fHasToRepaint =false;
103   } else {                                        136   } else {
104     fHasToRepaint =true;                          137     fHasToRepaint =true;
105   }                                               138   }
106                                                   139 
107   // Set the component visible                    140   // Set the component visible
                                                   >> 141   setVisible(true) ;
108                                                   142   
109   // and update it immediatly before wait for     143   // and update it immediatly before wait for SessionStart() (batch mode)
110 //  QCoreApplication::sendPostedEvents () ;    << 144   QCoreApplication::sendPostedEvents () ;
111                                                << 
112   // Set jpg as default export format for Qt v << 
113   setExportImageFormat("jpg");                 << 
114 }                                                 145 }
115 #endif                                         << 
116                                                   146 
117                                                   147 
118 void  G4OpenGLImmediateQtViewer::DrawView() {     148 void  G4OpenGLImmediateQtViewer::DrawView() {
119 #if QT_VERSION < 0x060000                      << 149 #ifdef G4MULTITHREADED
120 #else                                          << 150   if (G4Threading::G4GetThreadId() == G4Threading::MASTER_ID) {
121   if(IsGettingPickInfos()) {                   << 
122     paintGL();                                 << 
123     return;                                    << 
124   }                                            << 
125 #endif                                         << 
126   if (G4Threading::IsMasterThread()) {         << 
127     updateQWidget();                              151     updateQWidget();
128   }                                               152   }
                                                   >> 153 #else
                                                   >> 154   updateQWidget();
                                                   >> 155 #endif
129 }                                                 156 }
130                                                   157 
131                                                   158 
132 void G4OpenGLImmediateQtViewer::ComputeView ()    159 void G4OpenGLImmediateQtViewer::ComputeView () {
133                                                   160 
134 #if QT_VERSION < 0x060000                      << 161 #ifdef G4DEBUG_VIS_OGL
                                                   >> 162   printf("G4OpenGLImmediateQtViewer::ComputeView %d %d   VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
                                                   >> 163 #endif
135   makeCurrent();                                  164   makeCurrent();
136   // If a double buffer context has been force    165   // If a double buffer context has been forced upon us, ignore the
137   // back buffer for this OpenGLImmediate view    166   // back buffer for this OpenGLImmediate view.
138   //  glDrawBuffer (GL_FRONT);                    167   //  glDrawBuffer (GL_FRONT);
139 #endif                                         << 
140                                                   168 
141   G4ViewParameters::DrawingStyle dstyle = GetV    169   G4ViewParameters::DrawingStyle dstyle = GetViewParameters().GetDrawingStyle();
142                                                   170 
143   if(dstyle!=G4ViewParameters::hlr &&             171   if(dstyle!=G4ViewParameters::hlr &&
144      haloing_enabled) {                           172      haloing_enabled) {
145                                                   173 
146     HaloingFirstPass ();                          174     HaloingFirstPass ();
147     NeedKernelVisit ();                           175     NeedKernelVisit ();
148     ProcessView ();                               176     ProcessView ();
149     FinishView();                                 177     FinishView();
                                                   >> 178 #ifdef G4DEBUG_VIS_OGL
                                                   >> 179   printf("G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
                                                   >> 180 #endif
150     HaloingSecondPass ();                         181     HaloingSecondPass ();
151                                                   182 
152   }                                               183   }
153                                                   184 
154   NeedKernelVisit ();  // Always need to visit    185   NeedKernelVisit ();  // Always need to visit G4 kernel.
155   ProcessView ();                                 186   ProcessView ();
156                                                   187 
157   if (isRecording()) {                            188   if (isRecording()) {
158     savePPMToTemp();                              189     savePPMToTemp();
159   }                                               190   }
160                                                   191    
161 #if QT_VERSION < 0x060000                      << 192 #ifdef G4DEBUG_VIS_OGL
162   fHasToRepaint = true;                        << 193   printf("G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
163 #endif                                            194 #endif
                                                   >> 195   fHasToRepaint = true;
164 }                                                 196 }
165                                                   197 
166 /**                                               198 /**
167    - Lors du resize de la fenetre, on doit non    199    - Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements
168 */                                                200 */
169 void G4OpenGLImmediateQtViewer::resizeGL(         201 void G4OpenGLImmediateQtViewer::resizeGL(
170  int aWidth                                       202  int aWidth
171 ,int aHeight)                                     203 ,int aHeight)
172 {                                                 204 {  
173   if ((aWidth > 0) && (aHeight > 0)) {            205   if ((aWidth > 0) && (aHeight > 0)) {
174 #if QT_VERSION < 0x060000                      << 
175     ResizeWindow(aWidth,aHeight);                 206     ResizeWindow(aWidth,aHeight);
176     fHasToRepaint = sizeHasChanged();             207     fHasToRepaint = sizeHasChanged();
177 #else                                          << 
178     ResizeWindow(devicePixelRatio()*aWidth,dev << 
179 #endif                                         << 
180   }                                               208   }
181 }                                                 209 }
182                                                   210 
183                                                   211 
184 void G4OpenGLImmediateQtViewer::paintGL()         212 void G4OpenGLImmediateQtViewer::paintGL()
185 {                                                 213 {
186 #if QT_VERSION < 0x060000                      << 
187   updateToolbarAndMouseContextMenu();             214   updateToolbarAndMouseContextMenu();
188 #else                                          << 
189   //G.Barrand: don't do any change in the GUI  << 
190 #endif                                         << 
191                                                   215 
192 #if QT_VERSION < 0x060000                      << 
193   if (fPaintEventLock) {                          216   if (fPaintEventLock) {
194 //    return ;                                    217 //    return ;
195   }                                               218   }
196   if (!fQGLWidgetInitialiseCompleted) {           219   if (!fQGLWidgetInitialiseCompleted) {
197     fPaintEventLock = false;                   << 220     fQGLWidgetInitialiseCompleted= true;
198     return;                                       221     return;
199   }                                               222   }
200   if ((getWinWidth() == 0) && (getWinHeight()     223   if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
201       return;                                     224       return;
202   }                                               225   }
203                                                   226 
204   // DO NOT RESIZE IF SIZE HAS NOT CHANGE         227   // DO NOT RESIZE IF SIZE HAS NOT CHANGE
205   if ( !fHasToRepaint) {                          228   if ( !fHasToRepaint) {
206     // L. Garnier : Trap to get the size with     229     // L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
207     // Tested on Qt4.5 on mac, 4.4 on windows,    230     // Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
208     int sw = 0;                                   231     int sw = 0;
209     int sh = 0;                                   232     int sh = 0;
210     if (!isMaximized() && !isFullScreen()) {      233     if (!isMaximized() && !isFullScreen()) {
211       sw = normalGeometry().width();              234       sw = normalGeometry().width();
212       sh = normalGeometry().height();             235       sh = normalGeometry().height();
213     } else {                                      236     } else {
214       sw = frameGeometry().width();               237       sw = frameGeometry().width();
215       sh = frameGeometry().height();              238       sh = frameGeometry().height();
216     }                                             239     }
217     if ((getWinWidth() == (unsigned int)sw) &&    240     if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
218       return;                                     241       return;
219                                                   242 
220     } else if ((sw == 0) && (sh == 0)) { // NO    243     } else if ((sw == 0) && (sh == 0)) { // NOT A TOP LEVEL WIDGET
221       if (((getWinWidth() == (unsigned int)wid    244       if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) { 
222         return;                                   245         return;
223       }                                           246       }
224     }                                             247     }
225   }                                               248   }
226 #else                                          << 249 #ifdef G4DEBUG_VIS_OGL
227   if ((getWinWidth() == 0) && (getWinHeight()  << 250   printf("G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
228 #endif                                         << 
229                                                << 
230 #if QT_VERSION < 0x060000                      << 
231 #else                                          << 
232   InitializeGLView ();                         << 
233   glDrawBuffer (GL_BACK);                      << 
234 #endif                                            251 #endif
235                                                   252 
236   SetView();                                      253   SetView();
237                                                   254    
238   ClearView (); //ok, put the background corre    255   ClearView (); //ok, put the background correct
239   ComputeView();                                  256   ComputeView();
240                                                   257 
241 #if QT_VERSION < 0x060000                      << 
242   fHasToRepaint = false; // could be set to fa    258   fHasToRepaint = false; // could be set to false by ComputeView
243                                                   259 
244   fPaintEventLock = false;                     << 260 #ifdef G4DEBUG_VIS_OGL
                                                   >> 261   printf("G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",fReadyToPaint);
245 #endif                                            262 #endif
                                                   >> 263   fPaintEventLock = false;
246 }                                                 264 }
247                                                   265 
248 void G4OpenGLImmediateQtViewer::mousePressEven    266 void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
249 {                                                 267 {
250   G4MousePressEvent(event);                       268   G4MousePressEvent(event);
251 }                                                 269 }
252                                                   270 
253 void G4OpenGLImmediateQtViewer::keyPressEvent     271 void G4OpenGLImmediateQtViewer::keyPressEvent (QKeyEvent * event) 
254 {                                                 272 {
255   G4keyPressEvent(event);                         273   G4keyPressEvent(event);
256 }                                                 274 }
257                                                   275 
258 void G4OpenGLImmediateQtViewer::keyReleaseEven    276 void G4OpenGLImmediateQtViewer::keyReleaseEvent (QKeyEvent * event)
259 {                                                 277 {
260   G4keyReleaseEvent(event);                       278   G4keyReleaseEvent(event);
261 }                                                 279 }
262                                                   280 
263 void G4OpenGLImmediateQtViewer::wheelEvent (QW    281 void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event)
264 {                                                 282 {
265   G4wheelEvent(event);                            283   G4wheelEvent(event);
266 }                                                 284 }
267                                                   285 
268 #if QT_VERSION < 0x060000                      << 
269 void G4OpenGLImmediateQtViewer::showEvent (QSh    286 void G4OpenGLImmediateQtViewer::showEvent (QShowEvent *) 
270 {                                                 287 {
271   if (fQGLWidgetInitialiseCompleted) {         << 288   fHasToRepaint = true;
272     fHasToRepaint = true;                      << 
273   }                                            << 
274 }                                                 289 }
275 #endif                                         << 290 
276                                                   291 
277 /**                                               292 /**
278  * This function was build in order to make a     293  * This function was build in order to make a zoom on double clic event.
279  * It was think to build a rubberband on the z    294  * It was think to build a rubberband on the zoom area, but never work fine
280  */                                               295  */
281 void G4OpenGLImmediateQtViewer::mouseDoubleCli    296 void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(QMouseEvent *)
282 {                                                 297 {
283   G4MouseDoubleClickEvent();                      298   G4MouseDoubleClickEvent();
284 }                                                 299 }
285                                                   300 
286 void G4OpenGLImmediateQtViewer::mouseReleaseEv    301 void G4OpenGLImmediateQtViewer::mouseReleaseEvent(QMouseEvent *event)
287 {                                                 302 {
288   G4MouseReleaseEvent(event);                     303   G4MouseReleaseEvent(event);
289 }                                                 304 }
290                                                   305 
291 void G4OpenGLImmediateQtViewer::mouseMoveEvent    306 void G4OpenGLImmediateQtViewer::mouseMoveEvent(QMouseEvent *event)
292 {                                                 307 {
293   G4MouseMoveEvent(event);                        308   G4MouseMoveEvent(event);
294 }                                                 309 }
295                                                   310 
296                                                   311 
297 void G4OpenGLImmediateQtViewer::contextMenuEve    312 void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
298 {                                                 313 {
299   G4manageContextMenuEvent(e);                    314   G4manageContextMenuEvent(e);
300 }                                                 315 }
301                                                   316 
302 #if QT_VERSION < 0x060000                      << 
303 void G4OpenGLImmediateQtViewer::paintEvent(QPa    317 void G4OpenGLImmediateQtViewer::paintEvent(QPaintEvent *) {
304   if (! fQGLWidgetInitialiseCompleted) {       << 
305     return;                                    << 
306   }                                            << 
307   // Force a repaint next time if the FRAMEBUF << 
308   fHasToRepaint = isFramebufferReady();        << 
309   if ( fHasToRepaint) {                           318   if ( fHasToRepaint) {
310 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))   << 
311     updateGL();                                   319     updateGL();
312 #else                                          << 
313     // Not sure this is correct....            << 
314     paintGL();                                 << 
315 #endif                                         << 
316   }                                               320   }
317 }                                                 321 }
318 #endif                                         << 
319                                                   322 
320                                                   323 
321 void G4OpenGLImmediateQtViewer::updateQWidget(    324 void G4OpenGLImmediateQtViewer::updateQWidget() {
322 #if QT_VERSION < 0x060000                      << 
323   if (fUpdateGLLock) {                         << 
324     return;                                    << 
325   }                                            << 
326                                                << 
327   if (! isCurrentWidget()){                    << 
328     return;                                    << 
329   }                                            << 
330                                                << 
331   fUpdateGLLock = true;                        << 
332   fHasToRepaint= true;                            325   fHasToRepaint= true;
                                                   >> 326   updateGL();
                                                   >> 327   updateSceneTreeComponentTreeWidgetInfos();
333   repaint();                                      328   repaint();
334   updateViewerPropertiesTableWidget();         << 329   fHasToRepaint= false;
335   updateSceneTreeWidget();                     << 
336   fUpdateGLLock= false;                        << 
337 #else                                          << 
338   //if (!isCurrentWidget()) return; //G.Barran << 
339   //G.Barrand: don't do any change in the GUI  << 
340   update();                                    << 
341 #endif                                         << 
342 }                                                 330 }
343                                                   331 
344                                                   332 
345 void G4OpenGLImmediateQtViewer::ShowView ()    << 333 void G4OpenGLImmediateQtViewer::ShowView (
                                                   >> 334 ) 
                                                   >> 335 //////////////////////////////////////////////////////////////////////////////
                                                   >> 336 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
346 {                                                 337 {
347 #if QT_VERSION < 0x060000                      << 
348   fHasToRepaint = true;                           338   fHasToRepaint = true;
349   activateWindow();                               339   activateWindow();
350 #else                                          << 
351   activateWindow();                            << 
352   ((QApplication*)G4Qt::getInstance ())->proce << 
353 #endif                                         << 
354 }                                                 340 }
                                                   >> 341 #endif
355                                                   342