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 11.0.p1)


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