Geant4-11
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
w
y
Enumerations
a
b
c
d
e
f
g
l
m
p
r
s
t
v
y
z
Enumerator
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
g
h
i
o
q
r
s
t
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
b
c
d
e
f
g
i
j
l
m
n
p
r
s
t
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
visualization
OpenInventor
src
G4SoQt.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
// F.W. Jones 05012018
28
29
#include <stdlib.h>
30
#include <string.h>
31
32
#include "
G4ios.hh
"
33
34
#include "
G4SoQt.hh
"
35
//#include "G4Qt.hh"
36
//#include "G4UImanager.hh"
37
38
#include <Inventor/Qt/SoQt.h>
39
#include <QMainWindow>
40
41
#include <qwidget.h>
42
#include <qapplication.h>
43
44
#ifndef G4GMAKE
45
#include "moc_G4SoQt.cpp"
46
#endif
47
48
G4SoQt
*
G4SoQt::instance
= NULL;
49
50
static
G4bool
QtInited
=
FALSE
;
51
52
53
/***************************************************************************/
54
G4SoQt
*
G4SoQt::getInstance
()
55
{
56
if
(
instance
==NULL) {
57
instance
=
new
G4SoQt
();
58
}
59
return
instance
;
60
}
61
62
63
/***************************************************************************/
64
G4SoQt::G4SoQt
()
65
// FWJ command-line arguments omitted for time being
66
//G4SoQt* G4SoQt(int a_argn, char** a_args, char*)
67
{
68
externalApp
=
false
;
69
70
// FWJ in G4Qt this is used. qApp is Qt global pointer
71
// to the (one and only one) QApplication object:
72
// new QApplication (*p_argn, args);
73
// if(!qApp) {
74
75
// FWJ detects existence of Qt UI or other running qApp
76
if
(qApp)
externalApp
=
true
;
77
78
QWidget* mainWin = SoQt::init(
"Geant4"
);
79
80
// FWJ Cf Xt:
81
QtInited
=
TRUE
;
82
83
// FWJ DEBUG
84
// G4cout << "G4SoQt: mainWin=" << mainWin << G4endl;
85
// G4cout << "G4SoQt: toplevelwidget=" << SoQt::getTopLevelWidget() << G4endl;
86
87
// FWJ CAN'T GET MENUBAR THIS WAY OR BY CAST
88
// QWidget* toplevel = SoQt::getTopLevelWidget();
89
// QMenuBar* menubar = QMainWindow::menuBar();
90
// G4cout << "G4OpenInventorQtExaminerViewer menubar=" << menubar << G4endl;
91
92
93
// FWJ will this work?
94
SetMainInteractor
(mainWin);
95
// SetMainInteractor(qApp);
96
// AddDispatcher ((G4DispatchFunction)XtDispatchEvent);
97
98
// FWJ no locale for now (see G4Qt.cc)
99
100
}
101
102
/***************************************************************************/
103
G4SoQt::~G4SoQt
()
104
{
105
if
(
this
==
instance
) {
106
instance
= NULL;
107
}
108
}
109
110
G4bool
G4SoQt::Inited
()
111
{
112
return
QtInited
;
113
}
114
115
/***************************************************************************/
116
void
*
G4SoQt::GetEvent
()
117
{
118
return
0;
119
}
120
121
122
/***************************************************************************/
123
void
G4SoQt::FlushAndWaitExecution
()
124
{
125
// FWJ the following is used in G4Qt:
126
// if(!qApp) return;
127
// This starts the Qt main loop:
128
// qApp->processEvents();
129
130
// FWJ no, should be done in secondaryLoop()!
131
// SoQt::mainLoop();
132
}
133
134
135
/***************************************************************************/
136
void
G4SoQt::SecondaryLoop
()
137
{
138
if
(
externalApp
)
return
;
139
140
// FWJ DEBUG
141
// G4cout <<
142
// "ENTERING OIQT VIEWER SECONDARY LOOP" << G4endl;
143
// else
144
145
G4cout
<<
146
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT"
<<
G4endl
;
147
148
SoQt::mainLoop();
149
}
150
151
152
/***************************************************************************/
153
void
G4SoQt::ExitSecondaryLoop
()
154
{
155
// FWJ DEBUG
156
// G4cout << "G4SoQt: EXIT SECONDARY LOOP externalApp=" <<
157
// externalApp << G4endl;
158
159
if
(
externalApp
)
return
;
160
SoQt::exitMainLoop();
161
}
162
/***************************************************************************/
163
bool
G4SoQt::IsExternalApp
()
164
{
165
return
externalApp
;
166
}
QtInited
static G4bool QtInited
Definition:
G4SoQt.cc:50
G4SoQt.hh
G4bool
bool G4bool
Definition:
G4Types.hh:86
G4ios.hh
G4endl
#define G4endl
Definition:
G4ios.hh:57
G4cout
G4GLOB_DLL std::ostream G4cout
TRUE
#define TRUE
Definition:
Globals.hh:27
FALSE
#define FALSE
Definition:
Globals.hh:23
G4SoQt
Definition:
G4SoQt.hh:46
G4SoQt::G4SoQt
G4SoQt()
Definition:
G4SoQt.cc:64
G4SoQt::getInstance
static G4SoQt * getInstance()
Definition:
G4SoQt.cc:54
G4SoQt::instance
static G4SoQt * instance
Definition:
G4SoQt.hh:65
G4SoQt::externalApp
bool externalApp
Definition:
G4SoQt.hh:68
G4SoQt::~G4SoQt
virtual ~G4SoQt()
Definition:
G4SoQt.cc:103
G4SoQt::Inited
G4bool Inited()
Definition:
G4SoQt.cc:110
G4SoQt::FlushAndWaitExecution
void FlushAndWaitExecution()
Definition:
G4SoQt.cc:123
G4SoQt::ExitSecondaryLoop
void ExitSecondaryLoop()
Definition:
G4SoQt.cc:153
G4SoQt::IsExternalApp
bool IsExternalApp()
Definition:
G4SoQt.cc:163
G4SoQt::SecondaryLoop
void SecondaryLoop()
Definition:
G4SoQt.cc:136
G4SoQt::GetEvent
void * GetEvent()
Definition:
G4SoQt.cc:116
G4VInteractorManager::SetMainInteractor
void SetMainInteractor(G4Interactor)
Definition:
G4VInteractorManager.cc:117
Generated by
1.9.3