Changeset 579 for trunk/geant4/visualization/OpenGL
- Timestamp:
- Sep 18, 2007, 6:39:37 PM (18 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 3 edited
-
include/G4OpenGLQtViewer.hh (modified) (2 diffs)
-
src/G4OpenGLQtViewer.cc (modified) (7 diffs)
-
src/G4OpenGLStoredQtViewer.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r566 r579 78 78 void createPopupMenu(); 79 79 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1); 80 80 81 QMenu *fContextMenu; 81 82 bool fMouseAction; // 1: rotate 0:move … … 104 105 void toggleAux(bool); 105 106 void toggleFullScreen(bool); 107 108 void dialogClosed(); 106 109 }; 107 110 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r571 r579 68 68 // ::wglMakeCurrent(fHDC,fHGLRC); 69 69 // fWindow->makeCurrent(); 70 G4OpenGLViewer::SetView (); 70 G4OpenGLViewer::SetView (); 71 71 printf("G4OpenGLQtViewer::SetView --------------------\n"); 72 72 } … … 85 85 printf("G4OpenGLQtViewer::ShowView +++++++++++++++++++++\n"); 86 86 glFlush (); 87 GLWindow->activateWindow(); 88 printf("G4OpenGLQtViewer::ShowView -----------------------\n"); 89 87 if (!GLWindow) { 88 G4cerr << "Visualization window not defined, please choose one before" << G4endl; 89 } else { 90 GLWindow->activateWindow(); 91 printf("G4OpenGLQtViewer::ShowView -----------------------\n"); 92 } 90 93 // // Empty the Windows message queue : 91 94 // MSG event; … … 132 135 foreach (QWidget *widget, QApplication::allWidgets()) { 133 136 if ((found== false) && (widget->inherits("QMainWindow"))) { 134 GLWindow = new QDialog(widget); 137 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n"); 138 GLWindow = new QDialog(widget,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); 135 139 found = true; 136 140 } 137 141 } 138 142 if (found==false) { 143 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n"); 139 144 GLWindow = new QDialog(); 140 145 } 141 146 } else { 147 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n"); 142 148 GLWindow = new QDialog(); 143 149 } … … 152 158 GLWindow->show(); 153 159 160 // delete the pointer if close this 161 // GLWindow->setAttribute(Qt::WA_DeleteOnClose); 162 163 QObject ::connect(GLWindow, 164 SIGNAL(rejected()), 165 this, 166 SLOT(dialogClosed())); 167 154 168 WinSize_x = 400; 155 169 WinSize_y = 400; … … 166 180 167 181 } 182 183 /** Close the dialog and set the pointer to NULL 184 */ 185 void G4OpenGLQtViewer::dialogClosed() { 186 GLWindow = NULL; 187 } 188 168 189 169 190 ////////////////////////////////////////////////////////////////////////////// … … 187 208 { 188 209 printf("G4OpenGLQtViewer::~G4OpenGLQtViewer \n"); 189 delete fContextMenu; 210 delete fContextMenu; 190 211 } 191 212 … … 357 378 void G4OpenGLQtViewer::manageContextMenuEvent(QContextMenuEvent *e) 358 379 { 359 if (!GLWindow) return; 380 if (!GLWindow) { 381 G4cerr << "Visualization window not defined, please choose one before" << G4endl; 382 } else { 360 383 361 if (!fContextMenu) 362 createPopupMenu(); 363 364 // launch menu 365 if ( fContextMenu ) { 366 fContextMenu->exec( e->globalPos() ); 367 // delete fContextMenu; 384 if (!fContextMenu) 385 createPopupMenu(); 386 387 // launch menu 388 if ( fContextMenu ) { 389 fContextMenu->exec( e->globalPos() ); 390 // delete fContextMenu; 391 } 368 392 } 369 393 e->accept(); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r565 r579 55 55 G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() { 56 56 printf("GLWidget::~GLWidget \n"); 57 makeCurrent(); 57 makeCurrent(); 58 // this is connect to the Dialog for deleting it properly 59 // when close event. 60 // ((QDialog*)window())->reject(); 58 61 printf("GLWidget::~GLWidget END\n"); 59 62 } … … 104 107 105 108 printf("G4OpenGLStoredQtViewer::DrawView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",WinSize_x, WinSize_y); 106 109 printf("G4OpenGLStoredQtViewer::DrawView Dialog adress : %d\n",GLWindow); 107 110 G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle(); 108 111 … … 116 119 // if necessary... 117 120 if (!fNeedKernelVisit) 118 printf("*************************** CASE 0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");119 121 120 122 if (!fNeedKernelVisit) KernelVisitDecision (); 121 printf("*************************** kernelVisit:%d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",fNeedKernelVisit);122 123 123 124 G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets). … … 209 210 { 210 211 if (!readyToPaint) { 211 printf(" \n\nG4OpenGLStoredQtViewer::paintGL ============ Not ready %d\n",readyToPaint);212 printf("G4OpenGLStoredQtViewer::paintGL ============ Not ready %d\n",readyToPaint); 212 213 readyToPaint= true; 213 214 return; … … 218 219 if ( !hasToRepaint) { 219 220 if (((WinSize_x == (G4int)width())) &&(WinSize_y == (G4int) height())) { 220 printf(" \n\nG4OpenGLStoredQtViewer::paintGL ============ Dont repaint\n");221 printf("G4OpenGLStoredQtViewer::paintGL ============ Dont repaint\n"); 221 222 return; 222 223 } 223 224 } 224 225 nbPaint++; 225 printf(" \n\nG4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint);226 printf("G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV %d ready %d\n",nbPaint,readyToPaint); 226 227 WinSize_x = (G4int) width(); 227 228 WinSize_y = (G4int) height(); … … 241 242 hasToRepaint =false; 242 243 243 printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n \n\n",nbPaint,readyToPaint);244 printf("G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %d ready %d\n",nbPaint,readyToPaint); 244 245 } 245 246
Note:
See TracChangeset
for help on using the changeset viewer.
