Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -6,6 +6,21 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-09-05 Ben Morgan (vis_toolssg-V11-01-12)
|
||||
- Set AUTOMOC property on module when Qt used.
|
||||
|
||||
## 2023-08-14 John Allison (vis_toolssg-V11-01-11)
|
||||
- G4ToolsSGQtGLES, G4ToolsSGQtZB:
|
||||
- Simplify IsUISessionCompatible.
|
||||
- Exploit new method, G4UImanager::GetBaseSession (intercoms-V11-01-07).
|
||||
|
||||
## 2023-07-16 John Allison (vis_toolssg-V11-01-10)
|
||||
- G4ToolsSGViewer: Protect null scene pointer (in case user forgets to create a scene).
|
||||
|
||||
## 2023-07-12 Guy Barrand (vis_toolssg-V11-01-09)
|
||||
- G4ToolsSGQtViewer.[hh,cc] renamed G4ToolsSGQtGLESViewer.[hh,cc] for consistency with the file naming pattern G4ToolsSG<windowing><renderer><something> applied in other sub-drivers as in G4ToolsSGQtZBViewer.hh.
|
||||
- G4ToolsSGQtGLES.cc, sources.cmake: class name G4ToolsSGQtViewer changed to G4ToolsSGQtGLESViewer.
|
||||
|
||||
## 2023-06-04 John Allison (vis_toolssg-V11-01-08)
|
||||
- IsUISessionCompatible: Remove the function where not necessary and tidy.
|
||||
|
||||
|
||||
+9
-9
@@ -25,8 +25,8 @@
|
||||
//
|
||||
// Guy Barrand 8th April 2021
|
||||
|
||||
#ifndef G4TOOLSSGQTVIEWER_HH
|
||||
#define G4TOOLSSGQTVIEWER_HH
|
||||
#ifndef G4TOOLSSGQTGLESVIEWER_HH
|
||||
#define G4TOOLSSGQTGLESVIEWER_HH
|
||||
|
||||
#include "G4ToolsSGViewer.hh"
|
||||
|
||||
@@ -55,33 +55,33 @@ private:
|
||||
G4VViewer* fViewer;
|
||||
};
|
||||
|
||||
class G4ToolsSGQtViewer : public G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer> {
|
||||
class G4ToolsSGQtGLESViewer : public G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer> {
|
||||
typedef G4ToolsSGViewer<toolx::Qt::session,toolx::Qt::sg_viewer> parent;
|
||||
public:
|
||||
G4ToolsSGQtViewer(toolx::Qt::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
G4ToolsSGQtGLESViewer(toolx::Qt::session& a_session,G4ToolsSGSceneHandler& a_scene_handler, const G4String& a_name)
|
||||
:parent(a_session,a_scene_handler,a_name)
|
||||
,fSGQWidget(nullptr)
|
||||
,fDestroyCallback(0)
|
||||
{
|
||||
fDestroyCallback = new G4ToolsSGQtDestroyCallback(this);
|
||||
}
|
||||
virtual ~G4ToolsSGQtViewer() {
|
||||
virtual ~G4ToolsSGQtGLESViewer() {
|
||||
delete fDestroyCallback; //it will remove the below signal/slot connection.
|
||||
}
|
||||
protected:
|
||||
G4ToolsSGQtViewer(const G4ToolsSGQtViewer& a_from):parent(a_from){}
|
||||
G4ToolsSGQtViewer& operator=(const G4ToolsSGQtViewer&) {return *this;}
|
||||
G4ToolsSGQtGLESViewer(const G4ToolsSGQtGLESViewer& a_from):parent(a_from){}
|
||||
G4ToolsSGQtGLESViewer& operator=(const G4ToolsSGQtGLESViewer&) {return *this;}
|
||||
public:
|
||||
virtual void Initialise() {
|
||||
if(fSGQWidget) return; //done.
|
||||
parent::Initialise();
|
||||
if(!fSGViewer) {
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: G4ToolsSGQtViewer has no toolx::Qt::sg_viewer." << G4endl;
|
||||
G4cerr << "G4ToolsSGQtGLESViewer::Initialise: ERROR: G4ToolsSGQtGLESViewer has no toolx::Qt::sg_viewer." << G4endl;
|
||||
return;
|
||||
}
|
||||
fSGQWidget = fSGViewer->shell();
|
||||
if (!fSGQWidget) {
|
||||
G4cerr << "G4ToolsSGQtViewer::Initialise: ERROR: toolx::Qt::sg_viewer has no QWidget shell." << G4endl;
|
||||
G4cerr << "G4ToolsSGQtGLESViewer::Initialise: ERROR: toolx::Qt::sg_viewer has no QWidget shell." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
//
|
||||
// Only do this if there are end-of-event models (e.g., trajectories) that
|
||||
// may require it.
|
||||
if (fSceneHandler.GetScene()->GetEndOfEventModelList().size()) {
|
||||
if (fSceneHandler.GetScene() && fSceneHandler.GetScene()->GetEndOfEventModelList().size()) {
|
||||
fNeedKernelVisit = true;
|
||||
DrawView(); // Draw trajectories, etc., from kept events
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
PUBLIC_HEADERS
|
||||
G4ToolsSGQtGLES.hh
|
||||
PRIVATE_HEADERS
|
||||
G4ToolsSGQtViewer.hh
|
||||
G4ToolsSGQtGLESViewer.hh
|
||||
SOURCES
|
||||
G4ToolsSGQtGLES.cc
|
||||
G4ToolsSGQtViewer.cc)
|
||||
G4ToolsSGQtGLESViewer.cc)
|
||||
|
||||
geant4_module_compile_definitions(G4ToolsSG PUBLIC G4VIS_USE_TOOLSSG_QT_GLES)
|
||||
|
||||
@@ -93,6 +93,8 @@ if(GEANT4_USE_TOOLSSG_QT_GLES)
|
||||
geant4_module_link_libraries(G4ToolsSG PRIVATE Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
geant4_set_module_property(G4ToolsSG PROPERTY AUTOMOC ON)
|
||||
|
||||
# Minor hack for MOC-ing. Qt's moc requires visibility of the private headers
|
||||
# - Will not affect external consumers and should be minimal impact interanally
|
||||
# as this is a leaf category
|
||||
@@ -119,6 +121,8 @@ if(GEANT4_USE_TOOLSSG_QT_ZB)
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
G4UIimplementation)
|
||||
|
||||
geant4_set_module_property(G4ToolsSG PROPERTY AUTOMOC ON)
|
||||
|
||||
# Minor hack for MOC-ing. Qt's moc requires visibility of the private headers
|
||||
# - Will not affect external consumers and should be minimal impact interanally
|
||||
# as this is a leaf category
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "G4ToolsSGQtGLES.hh"
|
||||
|
||||
#include "G4ToolsSGQtViewer.hh"
|
||||
#include "G4ToolsSGQtGLESViewer.hh"
|
||||
|
||||
#include "G4Qt.hh"
|
||||
|
||||
@@ -72,7 +72,7 @@ G4VSceneHandler* G4ToolsSGQtGLES::CreateSceneHandler(const G4String& a_name) {
|
||||
G4VViewer* G4ToolsSGQtGLES::CreateViewer(G4VSceneHandler& a_scene,const G4String& a_name) {
|
||||
if(!fSGSession) Initialise();
|
||||
if(!fSGSession) return nullptr;
|
||||
G4VViewer* pView = new G4ToolsSGQtViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
G4VViewer* pView = new G4ToolsSGQtGLESViewer(*fSGSession,(G4ToolsSGSceneHandler&)a_scene,a_name);
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr << "G4ToolsSGQtGLES::CreateViewer:"
|
||||
@@ -91,25 +91,8 @@ G4VViewer* G4ToolsSGQtGLES::CreateViewer(G4VSceneHandler& a_scene,const G4String
|
||||
|
||||
G4bool G4ToolsSGQtGLES::IsUISessionCompatible () const
|
||||
{
|
||||
G4bool isCompatible = false;
|
||||
G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetSession();
|
||||
|
||||
// If session is a batch session, it may be:
|
||||
// a) this is a batch job (the user has not instantiated any UI session);
|
||||
// b) we are currently processing a UI command, in which case the UI
|
||||
// manager creates a temporary batch session and to find out if there is
|
||||
// a genuine UI session that the user has instantiated we must drill
|
||||
// down through previous sessions to a possible non-batch session.
|
||||
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
session = batch->GetPreviousSession();
|
||||
}
|
||||
|
||||
// Qt windows are only appropriate in a Qt session.
|
||||
// This is the originating non-batch session...
|
||||
if (dynamic_cast<G4UIQt*>(session)) {
|
||||
// ...and it's a G4UIQt session, which is OK.
|
||||
isCompatible = true;
|
||||
}
|
||||
return isCompatible;
|
||||
// Qt windows require a Qt session.
|
||||
G4UIsession* baseSession = G4UImanager::GetUIpointer()->GetBaseSession();
|
||||
if (dynamic_cast<G4UIQt*>(baseSession) != nullptr) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,6 +24,6 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#include "G4ToolsSGQtViewer.hh"
|
||||
#include "moc_G4ToolsSGQtViewer.cpp"
|
||||
#include "G4ToolsSGQtGLESViewer.hh"
|
||||
#include "moc_G4ToolsSGQtGLESViewer.cpp"
|
||||
|
||||
@@ -91,25 +91,8 @@ G4VViewer* G4ToolsSGQtZB::CreateViewer(G4VSceneHandler& a_scene,const G4String&
|
||||
|
||||
G4bool G4ToolsSGQtZB::IsUISessionCompatible () const
|
||||
{
|
||||
G4bool isCompatible = false;
|
||||
G4UImanager* ui = G4UImanager::GetUIpointer();
|
||||
G4UIsession* session = ui->GetSession();
|
||||
|
||||
// If session is a batch session, it may be:
|
||||
// a) this is a batch job (the user has not instantiated any UI session);
|
||||
// b) we are currently processing a UI command, in which case the UI
|
||||
// manager creates a temporary batch session and to find out if there is
|
||||
// a genuine UI session that the user has instantiated we must drill
|
||||
// down through previous sessions to a possible non-batch session.
|
||||
while (G4UIbatch* batch = dynamic_cast<G4UIbatch*>(session)) {
|
||||
session = batch->GetPreviousSession();
|
||||
}
|
||||
|
||||
// Qt windows are only appropriate in a Qt session.
|
||||
// This is the originating non-batch session...
|
||||
if (dynamic_cast<G4UIQt*>(session)) {
|
||||
// ...and it's a G4UIQt session, which is OK.
|
||||
isCompatible = true;
|
||||
}
|
||||
return isCompatible;
|
||||
// Qt windows require a Qt session.
|
||||
G4UIsession* baseSession = G4UImanager::GetUIpointer()->GetBaseSession();
|
||||
if (dynamic_cast<G4UIQt*>(baseSession) != nullptr) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user