ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenInventorQtExaminerViewer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4OpenInventorQtExaminerViewer.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 // Frederick Jones TRIUMF 07 January 2018
28 
29 #ifdef G4VIS_BUILD_OIQT_DRIVER
30 
32 
33 #include "G4ios.hh"
34 
35 #include <Inventor/Qt/SoQt.h>
36 #include <Inventor/events/SoKeyboardEvent.h>
37 
38 
39 G4OpenInventorQtExaminerViewer* G4OpenInventorQtExaminerViewer::viewer = 0;
40 
41 
42 // Constructor
43 G4OpenInventorQtExaminerViewer::
44 G4OpenInventorQtExaminerViewer(QWidget* parent, const char* name, SbBool embed,
45  SoQtFullViewer::BuildFlag flag,
46  SoQtViewer::Type type)
47  : SoQtExaminerViewer(parent, name, embed, flag, type)
48 {
49  G4cout << "G4OpenInventorQtExaminerViewer CONSTRUCTOR CALLED" << G4endl;
50  viewer = this;
51 }
52 
53 // Destructor
54 G4OpenInventorQtExaminerViewer::~G4OpenInventorQtExaminerViewer()
55 {
56  // if (superimposition != NULL) {
57  // removeSuperimposition(superimposition);
58  // superimposition->unref();
59  // superimposition = NULL;
60  // }
61  // if (animateSensor->isScheduled())
62  // animateSensor->unschedule();
63  // delete animateSensor;
64  // delete sceneChangeSensor;
65  //
66  // delete[] curViewPtName;
67  // delete searcher;
68 
69  viewer = 0;
70 }
71 
72 
73 // FWJ try to handle events as in XtExaminerViewer
74 SbBool
75 G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
76 {
77 
78  // SoCamera *cam = getCamera();
79  const SoType type(ev->getTypeId());
80 
81  if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
82  SoKeyboardEvent* ke = (SoKeyboardEvent*)ev;
83 
84  if (SoKeyboardEvent::isKeyPressEvent(ev, ke->getKey())) {
85  switch (ke->getKey()) {
86  case SoKeyboardEvent::E:
87  G4cout << "E KEY PRESSED, EXITING Qt MAIN LOOP" << G4endl;
88  SoQt::exitMainLoop();
89  break;
90  default:
91  break;
92  }
93  }
94  }
95  // Pass the event on to the viewer
96  // Need some checks here as in Xt viewer?
97  return SoQtExaminerViewer::processSoEvent(ev);
98 }
99 
100 #endif