Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenInventorQt.cc
Go to the documentation of this file.
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// Frederick Jones TRIUMF 30 NOV 2017
28
29#ifdef G4VIS_BUILD_OIQT_DRIVER
30
31// this :
32#include "G4OpenInventorQt.hh"
33
34#include <Inventor/Qt/SoQt.h>
35
36#include "G4SoQt.hh"
37#include "G4UIQt.hh"
38#include "G4Qt.hh"
39#include "G4UImanager.hh"
40#include <qobject.h>
41//#include "G4Qt.hh"
44
45#ifndef G4GMAKE
46#include "moc_G4OpenInventorQt.cpp"
47#endif
48
49G4OpenInventorQt::G4OpenInventorQt()
50 : G4OpenInventor("OpenInventorQt", "OIQt", G4VGraphicsSystem::threeD),
51 fInited(false)
52{
53}
54
55void G4OpenInventorQt::Initialize()
56{
57 if(fInited) return; //Done
58
59 // FWJ DEBUG
60 // G4cout << "G4OpenInventorQt: SETINTERACTORMANAGER " << G4SoQt::getInstance()
61 // << G4endl;
62
63 SetInteractorManager(G4SoQt::getInstance());
64
65 // FWJ DEBUG
66 // G4cout << "G4OpenInventorQt: GETINTERACTORMANAGER " << GetInteractorManager()
67 // << G4endl;
68
69 // FWJ from G4OIXt: these have no counterpart in Qt
70 // GetInteractorManager() ->
71 // RemoveDispatcher((G4DispatchFunction)XtDispatchEvent);
72 // GetInteractorManager() ->
73 // AddDispatcher((G4DispatchFunction)SoXt::dispatchEvent);
74 // Widget top = (Widget)GetInteractorManager()->GetMainInteractor();
75
76 // FWJ apparently not used in OpenGLQt:
77 // if(getenv("XENVIRONMENT")==NULL) {
78 // XrmDatabase database = XrmGetDatabase(QtDisplay(top));
79 // if(database!=NULL) {
80 // XrmPutLineResource(&database,"*topShadowColor:white");
81 // XrmPutLineResource(&database,"*bottomShadowColor:black");
82 // XrmPutLineResource(&database,"*foreground:black");
83 // XrmPutLineResource(&database,"*background:lightgrey");
84 // XrmPutLineResource(&database,"*borderColor:lightgrey");
85 // XrmPutLineResource(&database,"*fontList:-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1");
86 // XrmPutLineResource(&database,"*help_popup.title:Help");
87 // XrmPutLineResource(&database,"*helpCancel.labelString:Cancel");
88 // XrmPutLineResource(&database,"*helpText.editMode:multi_line_edit");
89 // XrmPutLineResource(&database,"*helpText.columns:60");
90 // XrmPutLineResource(&database,"*helpText.rows:20");
91 // XrmPutLineResource(&database,"*helpText.background:white");
92 // XrmPutLineResource(&database,"*helpText.fontList:*courier*-r-*--14-*");
93 // XrmPutLineResource(&database,"*helpText.maxLength:8000");
94 // }
95 // }
96
97 // FWJ for now, create an independent main window
98
99 // NOW should be done in G4SoQt [public G4VInteractorManager]
100 //QWidget* mainWin = SoQt::init("Geant4");
101
102 // Note that GetMainInteractor() returns G4Interactor [typedef void*]
103 //QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
104
105 // FWJ DEBUG
106 // G4cout << "OpenInventorQt: OBTAINED SoQt main window " << mainWin << G4endl;
107 // G4cout << "SoQt::getTopLevelWidget()" << SoQt::getTopLevelWidget() << G4endl;
108
109 // In parent G4OpenInventor
110 InitNodes();
111
112 fInited = true;
113}
114
115G4OpenInventorQt::~G4OpenInventorQt()
116{
117}
118
119G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
120 const G4String& name)
121{
123 G4UIQt *uiQt = static_cast<G4UIQt*> (UI->GetG4UIWindow());
124 if (uiQt) {
125 if (!((G4Qt*)(GetInteractorManager()->GetMainInteractor()))->IsExternalApp()) {
126 QWidget* mainWin = (QWidget*)(GetInteractorManager()->GetMainInteractor());
127 // Trying to get around git by adding this comment 2
128 uiQt->AddTabWidget((QWidget*)mainWin,QString(name));
129 }
130 }
131
132 Initialize();
133
134 G4OpenInventorSceneHandler* pScene = (G4OpenInventorSceneHandler*)&scene;
135 return new G4OpenInventorQtViewer(*pScene, name);
136}
137
138#endif
G4UIsession * GetG4UIWindow() const
Definition: G4UImanager.hh:181
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77