ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SoQt.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4SoQt.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // F.W. Jones 05012018
28 
29 #if defined(G4VIS_BUILD_OIQT_DRIVER)
30 //#if defined(G4INTY_BUILD_QT) || defined(G4INTY_USE_QT)
31 
32 #include <stdlib.h>
33 #include <string.h>
34 
35 #include "G4ios.hh"
36 
37 #include "G4SoQt.hh"
38 //#include "G4Qt.hh"
39 //#include "G4UImanager.hh"
40 
41 #include <Inventor/Qt/SoQt.h>
42 
43 #include <qwidget.h>
44 #include <qapplication.h>
45 
46 
47 G4SoQt* G4SoQt::instance = NULL;
48 
49 static G4bool QtInited = FALSE;
50 
51 /***************************************************************************/
52 G4SoQt* G4SoQt::getInstance()
53 {
54  if (instance==NULL) {
55  instance = new G4SoQt();
56  }
57  return instance;
58  // return G4SoQt::getInstance(0, NULL, (char*)"Geant4");
59 }
60 
61 /***************************************************************************/
62 //G4SoQt* G4SoQt::getInstance(int a_argn, char** a_args, char* a_class)
63 //{
64 // if (instance==NULL) {
65 // instance = new G4SoQt();
66 // }
67 // return instance;
68 //}
69 
70 /***************************************************************************/
71 G4SoQt::G4SoQt()
72 // FWJ command-line arguments omitted for time being
73 //G4SoQt* G4SoQt(int a_argn, char** a_args, char*)
74 {
75  externalApp = false;
76 
77  // FWJ in G4Qt this is used. qApp is Qt global pointer
78  // to the (one and only one) QApplication object:
79  // new QApplication (*p_argn, args);
80  // if(!qApp) {
81 
82  QWidget* mainWin = SoQt::init("Geant4");
83 
84  // FWJ will this work?
85  SetMainInteractor(mainWin);
86  // SetMainInteractor(qApp);
87  // AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
88 
89 // FWJ no locale for now (see G4Qt.cc)
90 
91 }
92 
93 /***************************************************************************/
94 G4SoQt::~G4SoQt()
95 {
96  if(this==instance) {
97  instance = NULL;
98  }
99 }
100 
101 G4bool G4SoQt::Inited()
102 {
103  return QtInited;
104 }
105 
106 /***************************************************************************/
107 void* G4SoQt::GetEvent()
108 {
109  return 0;
110 }
111 
112 
113 /***************************************************************************/
114 void G4SoQt::FlushAndWaitExecution()
115 {
116  // FWJ the following is used in G4Qt:
117  // if(!qApp) return;
118  // This starts the Qt main loop:
119  // qApp->processEvents();
120 
121  // FWJ no, should be done in secondaryLoop()!
122  // SoQt::mainLoop();
123 }
124 /***************************************************************************/
125 void G4SoQt::SecondaryLoop()
126 {
127  G4cout << "G4SoQt: SECONDARY LOOP CALLED !!!!!!" << G4endl;
128  SoQt::mainLoop();
129 }
130 
131 
132 /***************************************************************************/
133 bool G4SoQt::IsExternalApp()
134 {
135  return externalApp;
136 }
137 
138 #endif