Changeset 1135 for trunk/source/visualization
- Timestamp:
- Oct 21, 2009, 10:14:58 AM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/History
r1133 r1135 1 $Id: History,v 1.15 4 2009/10/15 15:33:30lgarnier Exp $1 $Id: History,v 1.155 2009/10/21 08:14:44 lgarnier Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 21 October 2009 Laurent Garnier 21 - G4OpenGLQtViewer : Prepare to attach viewer In UI 22 19 23 15 October 2009 Laurent Garnier 20 24 - G4OpenGLViewer.cc : Fix a problem with printing. On mac OSX version -
trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r1132 r1135 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.hh,v 1. 19 2009/10/14 15:04:09lgarnier Exp $27 // $Id: G4OpenGLQtViewer.hh,v 1.20 2009/10/21 08:14:44 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 150 150 void setRecordingInfos(QString); 151 151 QString getProcessErrorMsg(); 152 152 QWidget* getParentWidget(); 153 153 154 154 #if QT_VERSION < 0x040000 -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1131 r1135 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1.4 4 2009/10/14 14:35:07lgarnier Exp $27 // $Id: G4OpenGLQtViewer.cc,v 1.45 2009/10/21 08:14:44 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 107 107 if(fWindow) return; //Done. 108 108 109 // launch Qt if not110 G4Qt* interactorManager = G4Qt::getInstance ();111 // G4UImanager* UI = G4UImanager::GetUIpointer();112 113 109 fWindow = glWidget ; 114 110 // fWindow->makeCurrent(); 115 111 116 // create window 117 if (((QApplication*)interactorManager->GetMainInteractor())) { 118 // look for the main window 119 bool found = false; 120 #if QT_VERSION < 0x040000 121 // theses lines does nothing exept this one "GLWindow = new QDialog(0..." 122 // but if I comment them, it doesn't work... 123 QWidgetList *list = QApplication::allWidgets(); 124 QWidgetListIt it( *list ); // iterate over the widgets 125 QWidget * widget; 126 while ( (widget=it.current()) != 0 ) { // for each widget... 127 ++it; 128 if ((found== false) && (widget->inherits("QMainWindow"))) { 129 fGLWindow = new QDialog(0,0,FALSE,Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WStyle_MinMax ); 130 found = true; 131 } 132 } 133 delete list; // delete the list, not the widgets 134 #else 135 foreach (QWidget *widget, QApplication::allWidgets()) { 136 if ((found== false) && (widget->inherits("QMainWindow"))) { 137 fGLWindow = new QDialog(0,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); 138 found = true; 139 } 140 } 141 #endif 142 143 #if QT_VERSION < 0x040000 144 glWidget->reparent(fGLWindow,0,QPoint(0,0)); 145 #else 146 glWidget->setParent(fGLWindow); 147 #endif 148 149 if (found==false) { 150 #ifdef G4DEBUG_VIS_OGL 151 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n"); 152 #endif 153 fGLWindow = new QDialog(); 154 } 155 } else { 156 #ifdef G4DEBUG_VIS_OGL 157 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n"); 158 #endif 159 fGLWindow = new QDialog(); 112 QWidget *myParent = getParentWidget(); 113 if (myParent != NULL) { 114 #if QT_VERSION < 0x040000 115 glWidget->reparent(myParent,0,QPoint(0,0)); 116 #else 117 glWidget->setParent(myParent); 118 #endif 160 119 } 161 120 … … 2547 2506 2548 2507 2549 void G4OpenGLQtViewer::drawText(2550 const char * str2551 ,int x2552 ,int y2553 ,int z2554 ,int size ) {2555 2556 #ifdef G4DEBUG_VIS_OGL2557 printf ("G4OpenGLStoredQtViewer::drawText-position %d,%d,%d-----------------------------------------\n",x,y,z);2558 #endif2559 2560 QFont f1 = QFont("Courrier", size, QFont::Bold);2561 f1.setPointSizeF(20);2562 2563 // FIXME : Interesting border effect : resizing world resize detector2564 // but not traces !2565 glColor3d (0.123456,0.1234560,0.123456);2566 fWindow->renderText (x,y,z,str,f1);2567 glColor3d (0.321,0.321,0.321);2568 }2569 2570 2571 2508 // FIXME : does not work on Qt3 2572 2509 void G4OpenGLQtViewer::processEncodeStdout() … … 2663 2600 } 2664 2601 2602 2603 2604 2605 QWidget *G4OpenGLQtViewer::getParentWidget() 2606 { 2607 // launch Qt if not 2608 G4Qt* interactorManager = G4Qt::getInstance (); 2609 // G4UImanager* UI = G4UImanager::GetUIpointer(); 2610 2611 bool found = false; 2612 2613 // create window 2614 if (((QApplication*)interactorManager->GetMainInteractor())) { 2615 // look for the main window 2616 #if QT_VERSION < 0x040000 2617 // theses lines does nothing exept this one "GLWindow = new QDialog(0..." 2618 // but if I comment them, it doesn't work... 2619 QWidgetList *list = QApplication::allWidgets(); 2620 QWidgetListIt it( *list ); // iterate over the widgets 2621 QWidget * widget; 2622 while ( (widget=it.current()) != 0 ) { // for each widget... 2623 ++it; 2624 if ((found== false) && (widget->inherits("QMainWindow"))) { 2625 fGLWindow = new QDialog(0,0,FALSE,Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WStyle_MinMax ); 2626 found = true; 2627 } 2628 } 2629 delete list; // delete the list, not the widgets 2630 #else 2631 foreach (QWidget *widget, QApplication::allWidgets()) { 2632 if ((found== false) && (widget->inherits("QMainWindow"))) { 2633 fGLWindow = new QDialog(widget,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); 2634 found = true; 2635 } 2636 } 2637 #endif 2638 2639 if (found==false) { 2640 #ifdef G4DEBUG_VIS_OGL 2641 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist, but not found\n"); 2642 #endif 2643 fGLWindow = new QDialog(); 2644 } 2645 } else { 2646 #ifdef G4DEBUG_VIS_OGL 2647 printf("G4OpenGLQtViewer::CreateMainWindow case Qapp exist\n"); 2648 #endif 2649 fGLWindow = new QDialog(); 2650 } 2651 if (found) { 2652 return fGLWindow; 2653 } else { 2654 return NULL; 2655 } 2656 } 2657 2665 2658 /* 2666 2659
Note: See TracChangeset
for help on using the changeset viewer.