Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLStoredQtViewer Class Reference

#include <G4OpenGLStoredQtViewer.hh>

Inheritance diagram for G4OpenGLStoredQtViewer:

Public Member Functions

 G4OpenGLStoredQtViewer (G4OpenGLStoredSceneHandler &scene, const G4String &name="")
 ~G4OpenGLStoredQtViewer ()
void Initialise ()
void initializeGL ()
void DrawView ()
void resizeGL (int width, int height)
void paintGL ()
void updateQWidget ()
void ShowView ()
void DisplayTimePOColourModification (G4Colour &, size_t)
Public Member Functions inherited from G4OpenGLQtViewer
 G4OpenGLQtViewer (G4OpenGLSceneHandler &scene)
virtual ~G4OpenGLQtViewer ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
virtual G4bool ReadyToDraw ()
void updateSceneTreeWidget ()
void updateViewerPropertiesTableWidget ()
void updatePickInfosWidget (int, int)
QString setEncoderPath (QString path)
QString getEncoderPath ()
QString setTempFolderPath (QString path)
QString getTempFolderPath ()
QString setSaveFileName (QString path)
QString getSaveFileName ()
bool isRecording ()
bool isStopped ()
bool isPaused ()
bool isEncoding ()
bool isWaiting ()
bool isFailed ()
void setWaiting ()
bool isBadEncoder ()
bool isBadOutput ()
bool isBadTmp ()
bool isSuccess ()
void setBadTmp ()
void setBadOutput ()
void setBadEncoder ()
bool isReadyToEncode ()
void resetRecording ()
void encodeVideo ()
void stopVideo ()
void saveVideo ()
bool generateMpegEncoderParameters ()
void displayRecordingStatus ()
void DrawText (const G4Text &)
void ResetView ()
void addPVSceneTreeElement (const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPVPOIndex)
void addNonPVSceneTreeElement (const G4String &model, int currentPVPOIndex, const std::string &modelDescription, const G4Visible &visible)
bool isTouchableVisible (int POindex)
void clearTreeWidget ()
bool exportImage (std::string name="", int width=-1, int height=-1)
G4bool GetWindowSize (unsigned int &a_w, unsigned int &a_h)
G4bool GetRenderAreaSize (unsigned int &a_w, unsigned int &a_h)
void G4MousePressEvent (QMouseEvent *event)
void G4wheelEvent (QWheelEvent *event)
void G4keyPressEvent (QKeyEvent *event)
void G4keyReleaseEvent (QKeyEvent *event)
void G4MouseDoubleClickEvent ()
void G4MouseReleaseEvent (QMouseEvent *evnt)
void G4MouseMoveEvent (QMouseEvent *event)
Public Member Functions inherited from G4OpenGLViewer
virtual void ClearView ()
void ClearViewWithoutFlush ()
bool setExportImageFormat (std::string format, bool quiet=false)
Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
virtual ~G4VViewer ()
void RefreshView ()
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
virtual void DoneWithMasterThread ()
virtual void MovingToVisSubThread ()
virtual void SwitchToVisSubThread ()
virtual void DoneWithVisSubThread ()
virtual void MovingToMasterThread ()
virtual void SwitchToMasterThread ()
void InsertModelInSceneTree (G4VModel *)
const G4SceneTreeItemGetSceneTree ()
G4SceneTreeItemAccessSceneTree ()
void UpdateGUISceneTree ()
void UpdateGUIControlWidgets ()
void UpdateGUIDrawingStyle ()
void UpdateGUIProjectionStyle ()
void UpdateGUITransparencySlider ()
const G4StringGetName () const
const G4StringGetShortName () const
void SetName (const G4String &)
G4int GetViewId () const
G4VSceneHandlerGetSceneHandler () const
const G4ViewParametersGetViewParameters () const
const G4ViewParametersGetDefaultViewParameters () const
G4double GetKernelVisitElapsedTimeSeconds () const
void SetViewParameters (const G4ViewParameters &vp)
void SetDefaultViewParameters (const G4ViewParameters &vp)
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
void SetNeedKernelVisit (G4bool need)
void NeedKernelVisit ()
void ProcessView ()
void ProcessTransients ()
void ZoomFromMouseWheel (G4double delta, G4bool shift=false, G4double xPos=0, G4double yPos=0)
Public Member Functions inherited from G4OpenGLStoredViewer
 G4OpenGLStoredViewer (G4OpenGLStoredSceneHandler &scene)
virtual ~G4OpenGLStoredViewer ()

Protected Member Functions

G4bool CompareForKernelVisit (G4ViewParameters &)
G4bool POSelected (size_t POListIndex)
G4bool TOSelected (size_t TOListIndex)
void showEvent (QShowEvent *event)
void wheelEvent (QWheelEvent *event)
void mousePressEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mouseDoubleClickEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
void contextMenuEvent (QContextMenuEvent *e)
void keyPressEvent (QKeyEvent *event)
void keyReleaseEvent (QKeyEvent *event)
void paintEvent (QPaintEvent *event)
Protected Member Functions inherited from G4OpenGLQtViewer
void CreateGLQtContext ()
virtual void CreateMainWindow (G4QGLWidgetType *, const QString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void G4manageContextMenuEvent (QContextMenuEvent *e)
void rotateQtScene (float, float)
void rotateQtSceneToggle (float, float)
void moveScene (float, float, float, bool)
void FinishView ()
void updateKeyModifierState (const Qt::KeyboardModifiers &)
void displaySceneTreeComponent ()
G4Colour getColorForPoIndex (int poIndex)
const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
bool isCurrentWidget ()
void savePPMToTemp ()
Protected Member Functions inherited from G4OpenGLViewer
 G4OpenGLViewer (G4OpenGLSceneHandler &scene)
virtual ~G4OpenGLViewer ()
virtual void SetView ()
void ChangePointSize (G4double size)
void ChangeLineWidth (G4double width)
void HaloingFirstPass ()
void HaloingSecondPass ()
void HLRFirstPass ()
void HLRSecondPass ()
void HLRThirdPass ()
void InitializeGLView ()
void ResizeGLView ()
void ResizeWindow (unsigned int, unsigned int)
virtual G4String Pick (GLdouble x, GLdouble y)
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
virtual void CreateFontLists ()
void rotateScene (G4double dx, G4double dy)
void rotateSceneToggle (G4double dx, G4double dy)
void setExportSize (G4int, G4int)
bool setExportFilename (G4String name, G4bool inc=true)
std::string getRealPrintFilename ()
unsigned int getWinWidth () const
unsigned int getWinHeight () const
G4bool sizeHasChanged ()
G4double GetSceneNearWidth ()
GLdouble getSceneFarWidth ()
GLdouble getSceneDepth ()
void addExportImageFormat (std::string format)
G4bool isGl2psWriting ()
G4bool isFramebufferReady ()
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
bool IsGettingPickInfos () const
Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
Protected Member Functions inherited from G4OpenGLStoredViewer
void KernelVisitDecision ()
void DrawDisplayLists ()
void AddPrimitiveForASingleFrame (const G4Text &text)
void AddPrimitiveForASingleFrame (const G4Circle &circle)

Additional Inherited Members

Public Slots inherited from G4OpenGLQtViewer
void startPauseVideo ()
Public Attributes inherited from G4VViewer
const G4int fMaxAllTouchables = 10000
G4bool fCurtailDescent = false
Protected Slots inherited from G4OpenGLQtViewer
void updateToolbarAndMouseContextMenu ()
Protected Attributes inherited from G4OpenGLQtViewer
G4UIQtfUiQt
QWidget * fGLWidget
int fRecordFrameNumber
bool fHasToRepaint
bool fUpdateGLLock
bool fQGLWidgetInitialiseCompleted
bool fPaintEventLock
bool fMouseOnSceneTree
Protected Attributes inherited from G4OpenGLViewer
G4bool fPrintColour
G4bool fVectoredPs
G4OpenGLSceneHandlerfOpenGLSceneHandler
G4Colour background
G4bool transparency_enabled
G4bool antialiasing_enabled
G4bool haloing_enabled
G4gl2psfGL2PSAction
G4double fRot_sens
G4double fPan_sens
unsigned int fWinSize_x
unsigned int fWinSize_y
std::vector< std::string > fExportImageFormatVector
std::string fDefaultExportImageFormat
std::string fExportImageFormat
int fExportFilenameIndex
G4int fPrintSizeX
G4int fPrintSizeY
Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
G4int fViewId
G4String fName
G4String fShortName
G4ViewParameters fVP
G4ViewParameters fDefaultVP
G4double fKernelVisitElapsedTimeSeconds = 999.
G4SceneTreeItem fSceneTree
G4bool fNeedKernelVisit
G4bool fTransientsNeedRedrawing
Protected Attributes inherited from G4OpenGLStoredViewer
G4OpenGLStoredSceneHandlerfG4OpenGLStoredSceneHandler
G4ViewParameters fLastVP
G4bool fDepthTestEnable
G4Colour fOldDisplayListColor

Detailed Description

Definition at line 44 of file G4OpenGLStoredQtViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLStoredQtViewer()

G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer ( G4OpenGLStoredSceneHandler & scene,
const G4String & name = "" )

Definition at line 45 of file G4OpenGLStoredQtViewer.cc.

47 :
48 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
49 G4OpenGLViewer (sceneHandler),
50 G4OpenGLQtViewer (sceneHandler),
51 G4OpenGLStoredViewer (sceneHandler), // FIXME : gerer le pb du parent !
53{
54 if (fViewId < 0) return; // In case error in base class instantiation.
55
56#if QT_VERSION < 0x060000
58
59 // Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. Note: Unlike WA_OpaquePaintEvent, newly exposed areas are never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the widget's author.
60 G4QGLWidgetType::setAttribute (Qt::WA_NoSystemBackground);
61
62 setFocusPolicy(Qt::StrongFocus); // enable keybord events
63 fHasToRepaint = false;
64 fPaintEventLock = false;
65 fUpdateGLLock = false;
66#else
67 // Indicates that the widget has no background, i.e. when the widget receives paint events, the background is not automatically repainted. Note: Unlike WA_OpaquePaintEvent, newly exposed areas are never filled with the background (e.g., after showing a window for the first time the user can see "through" it until the application processes the paint events). This flag is set or cleared by the widget's author.
68 G4QGLWidgetType::setAttribute (Qt::WA_NoSystemBackground);
69
70 setFocusPolicy(Qt::StrongFocus); // enable keybord events
71#endif
72}
QOpenGLWidget G4QGLWidgetType
G4OpenGLQtViewer(G4OpenGLSceneHandler &scene)
G4OpenGLStoredViewer(G4OpenGLStoredSceneHandler &scene)
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
G4int fViewId
Definition G4VViewer.hh:269
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition G4VViewer.cc:49

◆ ~G4OpenGLStoredQtViewer()

G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer ( )

Definition at line 74 of file G4OpenGLStoredQtViewer.cc.

74{}

Member Function Documentation

◆ CompareForKernelVisit()

G4bool G4OpenGLStoredQtViewer::CompareForKernelVisit ( G4ViewParameters & lastVP)
protectedvirtual

Reimplemented from G4OpenGLStoredViewer.

Definition at line 120 of file G4OpenGLStoredQtViewer.cc.

121{
122 // Identical to G4OpenGLStoredViewer::CompareForKernelVisit except
123 // for checking of VisAttributesModifiers, because
124 // G4OpenGLStoredQtViewer keeps track of its own touchable
125 // modifiers (fTreeItemModels, etc.).
126 if (
127 (lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
128 (lastVP.GetNumberOfCloudPoints() != fVP.GetNumberOfCloudPoints()) ||
129 (lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
130 (lastVP.IsCulling () != fVP.IsCulling ()) ||
131 (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
132 (lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
133 (lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
134 (lastVP.GetCBDAlgorithmNumber() !=
135 fVP.GetCBDAlgorithmNumber()) ||
136 // Note: Section and Cutaway can reveal back-facing faces. If
137 // backface culling is implemented, the image can look strange because
138 // the back-facing faces are not there. For the moment, we have disabled
139 // (commented out) backface culling (it seems not to affect performance -
140 // in fact, performance seems to improve), so there is no problem.
141 (lastVP.IsSection () != fVP.IsSection ()) ||
142 // Section (DCUT) is NOT implemented locally so we need to visit the kernel.
143 // (lastVP.IsCutaway () != fVP.IsCutaway ()) ||
144 // Cutaways are implemented locally so we do not need to visit the kernel.
145 (lastVP.IsExplode () != fVP.IsExplode ()) ||
146 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
147 (lastVP.GetGlobalMarkerScale() != fVP.GetGlobalMarkerScale()) ||
148 (lastVP.GetGlobalLineWidthScale() != fVP.GetGlobalLineWidthScale()) ||
149 (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
150 (lastVP.GetDefaultVisAttributes()->GetColour() !=
151 fVP.GetDefaultVisAttributes()->GetColour()) ||
153 fVP.GetDefaultTextVisAttributes()->GetColour()) ||
154 (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
155 (lastVP.IsPicking () != fVP.IsPicking ()) ||
156 (lastVP.IsSpecialMeshRendering() != fVP.IsSpecialMeshRendering()) ||
157 (lastVP.GetSpecialMeshRenderingOption() != fVP.GetSpecialMeshRenderingOption()) ||
158 (lastVP.GetTransparencyByDepth() != fVP.GetTransparencyByDepth()) ||
159 (lastVP.IsDotsSmooth() != fVP.IsDotsSmooth()) ||
160 (lastVP.GetDotsSize() != fVP.GetDotsSize())
161 )
162 return true;
163
164 // Don't check VisAttributesModifiers if this comparison has been
165 // initiated by a mouse interaction on the scene tree.
166 if (fMouseOnSceneTree) {
167 // Reset the flag.
168 fMouseOnSceneTree = false;
169 } else {
170 // Not initiated by a mouse so compare for kernel visit.
171 if (lastVP.GetVisAttributesModifiers() != fVP.GetVisAttributesModifiers()) {
172 return true;
173 }
174 }
175
176 if (lastVP.IsDensityCulling () &&
177 (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
178 return true;
179
180// /**************************************************************
181// If section (DCUT) is implemented locally, comment this out.
182 if (lastVP.IsSection () &&
183 (lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
184 return true;
185// ***************************************************************/
186
187 /**************************************************************
188 If cutaways are implemented locally, comment this out.
189 if (lastVP.IsCutaway ()) {
190 if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
191 if (lastVP.GetCutawayPlanes ().size () !=
192 fVP.GetCutawayPlanes ().size ()) return true;
193 for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
194 if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
195 return true;
196 }
197 ***************************************************************/
198
199 if (lastVP.GetCBDAlgorithmNumber() > 0) {
200 if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
201 else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
202 }
203
204 if (lastVP.IsExplode () &&
205 (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
206 return true;
207
208 if (lastVP.IsSpecialMeshRendering() &&
209 (lastVP.GetSpecialMeshVolumes() != fVP.GetSpecialMeshVolumes()))
210 return true;
211
212 if (lastVP.GetTransparencyByDepth() > 0. &&
213 lastVP.GetTransparencyByDepthOption() != fVP.GetTransparencyByDepthOption())
214 return true;
215
216 return false;
217}
G4ViewParameters fVP
Definition G4VViewer.hh:272
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsMarkerNotHidden() const
G4double GetGlobalLineWidthScale() const
const G4Colour & GetBackgroundColour() const
G4bool IsSection() const
G4bool IsPicking() const
G4bool IsDotsSmooth() const
G4bool IsCulling() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsExplode() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4int GetTransparencyByDepthOption() const
G4double GetGlobalMarkerScale() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
SMROption GetSpecialMeshRenderingOption() const
G4double GetDotsSize() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4double GetTransparencyByDepth() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const

◆ contextMenuEvent()

void G4OpenGLStoredQtViewer::contextMenuEvent ( QContextMenuEvent * e)
protected

Definition at line 477 of file G4OpenGLStoredQtViewer.cc.

478{
480}
void G4manageContextMenuEvent(QContextMenuEvent *e)

◆ DisplayTimePOColourModification()

void G4OpenGLStoredQtViewer::DisplayTimePOColourModification ( G4Colour & c,
size_t poIndex )
virtual

Reimplemented from G4OpenGLStoredViewer.

Definition at line 519 of file G4OpenGLStoredQtViewer.cc.

521 {
522 c = getColorForPoIndex((int)poIndex);
523}
G4Colour getColorForPoIndex(int poIndex)

◆ DrawView()

void G4OpenGLStoredQtViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 229 of file G4OpenGLStoredQtViewer.cc.

229 {
230#if QT_VERSION < 0x060000
231#else
232 if(IsGettingPickInfos()) {
233 paintGL();
234 return;
235 }
236#endif
237#if (QT_VERSION < 0x060000) || !defined(G4MULTITHREADED)
239#else
242 } else {
243 update(); //G.Barrand: updateQWidget() induces a crash on run beamOn.
244 }
245#endif
246}
bool IsGettingPickInfos() const
G4bool IsMasterThread()

◆ Initialise()

void G4OpenGLStoredQtViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 76 of file G4OpenGLStoredQtViewer.cc.

76 {
77#if QT_VERSION < 0x060000
78
80 CreateMainWindow (this,QString(GetName()));
81
82 makeCurrent();
83 glDrawBuffer (GL_BACK);
84
85 // set the good tab active
86 if (G4QGLWidgetType::parentWidget()) {
87 auto *parentTab = dynamic_cast<QTabWidget*> (G4QGLWidgetType::parentWidget()->parent()) ;
88 if (parentTab) {
89 parentTab->setCurrentIndex(parentTab->count()-1);
90 }
91 }
92
94#else
95 CreateMainWindow (this,QString(GetName()));
96 // Set jpg as default export format for Qt viewer
98#endif
99}
virtual void CreateMainWindow(G4QGLWidgetType *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool setExportImageFormat(std::string format, bool quiet=false)
const G4String & GetName() const

◆ initializeGL()

void G4OpenGLStoredQtViewer::initializeGL ( )

Definition at line 102 of file G4OpenGLStoredQtViewer.cc.

102 {
103
105
106 if (fSceneHandler.GetScene() == 0) {
107 fHasToRepaint =false;
108 } else {
109 fHasToRepaint =true;
110 }
111
112 // Set the component visible
113 // setVisible(true) ;
114
115 // Set jpg as default export format for Qt viewer
117}
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:268

◆ keyPressEvent()

void G4OpenGLStoredQtViewer::keyPressEvent ( QKeyEvent * event)
protected

Definition at line 433 of file G4OpenGLStoredQtViewer.cc.

434{
435 G4keyPressEvent(event);
436}
void G4keyPressEvent(QKeyEvent *event)

◆ keyReleaseEvent()

void G4OpenGLStoredQtViewer::keyReleaseEvent ( QKeyEvent * event)
protected

Definition at line 438 of file G4OpenGLStoredQtViewer.cc.

439{
440 G4keyReleaseEvent(event);
441}
void G4keyReleaseEvent(QKeyEvent *event)

◆ mouseDoubleClickEvent()

void G4OpenGLStoredQtViewer::mouseDoubleClickEvent ( QMouseEvent * event)
protected

This function was build in order to make a zoom on double clic event. It was think to build a rubberband on the zoom area, but never work fine

Definition at line 461 of file G4OpenGLStoredQtViewer.cc.

462{
464}

◆ mouseMoveEvent()

void G4OpenGLStoredQtViewer::mouseMoveEvent ( QMouseEvent * event)
protected

Definition at line 471 of file G4OpenGLStoredQtViewer.cc.

472{
473 G4MouseMoveEvent(event);
474}
void G4MouseMoveEvent(QMouseEvent *event)

◆ mousePressEvent()

void G4OpenGLStoredQtViewer::mousePressEvent ( QMouseEvent * event)
protected

Definition at line 428 of file G4OpenGLStoredQtViewer.cc.

429{
430 G4MousePressEvent(event);
431}
void G4MousePressEvent(QMouseEvent *event)

◆ mouseReleaseEvent()

void G4OpenGLStoredQtViewer::mouseReleaseEvent ( QMouseEvent * event)
protected

Definition at line 466 of file G4OpenGLStoredQtViewer.cc.

467{
468 G4MouseReleaseEvent(event);
469}
void G4MouseReleaseEvent(QMouseEvent *evnt)

◆ paintEvent()

void G4OpenGLStoredQtViewer::paintEvent ( QPaintEvent * event)
protected

Definition at line 407 of file G4OpenGLStoredQtViewer.cc.

407 {
409 return;
410 }
411 // Force a repaint next time if the FRAMEBUFFER is not READY
413 if ( fHasToRepaint) {
414 // Will really update the widget by calling CGLFlushDrawable
415 // The widget's rendering context will become the current context and initializeGL()
416 // will be called if it hasn't already been called.
417 // Copies the back buffer of a double-buffered context to the front buffer.
418#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
419 updateGL();
420#else
421 // Not sure this is correct....
422 paintGL();
423#endif
424 }
425}
G4bool isFramebufferReady()

◆ paintGL()

void G4OpenGLStoredQtViewer::paintGL ( )

Definition at line 341 of file G4OpenGLStoredQtViewer.cc.

342{
343#if QT_VERSION < 0x060000
345#else
346 //G.Barrand: don't do any change in the GUI here, just "paint" this widget!
347#endif
348
349#if QT_VERSION < 0x060000
350 if (fPaintEventLock) {
351// return ;
352 }
353 fPaintEventLock = true;
354 if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
355 return;
356 }
357
359 fPaintEventLock = false;
360 return;
361 }
362
363 // DO NOT RESIZE IF SIZE HAS NOT CHANGE :
364 // WHEN CLICK ON THE FRAME FOR EXAMPLE
365 // EXECEPT WHEN MOUSE MOVE EVENT
366 if ( !fHasToRepaint) {
367 // L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
368 // Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
369 int sw = 0;
370 int sh = 0;
371 if (!isMaximized() && !isFullScreen()) {
372 sw = normalGeometry().width();
373 sh = normalGeometry().height();
374 } else {
375 sw = frameGeometry().width();
376 sh = frameGeometry().height();
377 }
378 if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
379 return;
380 }
381 }
382#else
383 if ((getWinWidth() == 0) && (getWinHeight() == 0)) return; //G.Barrand: needed?
384#endif
385
386#if QT_VERSION < 0x060000
387#else
389#endif
390
391 // Ensure that we really draw the BACK buffer
392 glDrawBuffer (GL_BACK);
393
394 SetView();
395
396 ClearView (); //ok, put the background correct
397 ComputeView();
398
399#if QT_VERSION < 0x060000
400 fHasToRepaint = false;
401
402 fPaintEventLock = false;
403#endif
404}
void updateToolbarAndMouseContextMenu()
virtual void SetView()
unsigned int getWinHeight() const
unsigned int getWinWidth() const
virtual void ClearView()

Referenced by DrawView(), and paintEvent().

◆ POSelected()

G4bool G4OpenGLStoredQtViewer::POSelected ( size_t POListIndex)
protectedvirtual

Reimplemented from G4OpenGLStoredViewer.

Definition at line 219 of file G4OpenGLStoredQtViewer.cc.

220{
221 return isTouchableVisible((int)POListIndex);
222}
bool isTouchableVisible(int POindex)

◆ resizeGL()

void G4OpenGLStoredQtViewer::resizeGL ( int aWidth,
int aHeight )
  • Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements

Definition at line 320 of file G4OpenGLStoredQtViewer.cc.

323{
324 // Set new size, it will be update when next Repaint()->SetView() called
325 if ((aWidth > 0) && (aHeight > 0)) {
326#if QT_VERSION < 0x060000
327 ResizeWindow(aWidth,aHeight);
329#else
330 ResizeWindow(devicePixelRatio()*aWidth,devicePixelRatio()*aHeight);
331#endif
332 }
333}
void ResizeWindow(unsigned int, unsigned int)
G4bool sizeHasChanged()

◆ showEvent()

void G4OpenGLStoredQtViewer::showEvent ( QShowEvent * event)
protected

Definition at line 449 of file G4OpenGLStoredQtViewer.cc.

450{
452 fHasToRepaint = true;
453 }
454}

◆ ShowView()

void G4OpenGLStoredQtViewer::ShowView ( void )
virtual

Reimplemented from G4VViewer.

Definition at line 510 of file G4OpenGLStoredQtViewer.cc.

511{
512 activateWindow();
513#if 0x060000 <= QT_VERSION
514 ((QApplication*)G4Qt::getInstance ())->processEvents();
515#endif
516}
static G4Qt * getInstance()
Definition G4Qt.cc:61

◆ TOSelected()

G4bool G4OpenGLStoredQtViewer::TOSelected ( size_t TOListIndex)
protectedvirtual

Reimplemented from G4OpenGLStoredViewer.

Definition at line 224 of file G4OpenGLStoredQtViewer.cc.

225{
226 return true;
227}

◆ updateQWidget()

void G4OpenGLStoredQtViewer::updateQWidget ( )
virtual

Implements G4OpenGLQtViewer.

Definition at line 482 of file G4OpenGLStoredQtViewer.cc.

482 {
483#if QT_VERSION < 0x060000
484 if (fUpdateGLLock) {
485 return;
486 }
487
488 if (! isCurrentWidget()){
489 return;
490 }
491
492 fUpdateGLLock = true;
493 fHasToRepaint= true;
494 // Will really update the widget by calling CGLFlushDrawable
495 // The widget's rendering context will become the current context and initializeGL()
496 // will be called if it hasn't already been called.
497 // Copies the back buffer of a double-buffered context to the front buffer.
498 repaint(); // will read scene tree state
499 // updateGL() // From J.Allison picking branch
502 fUpdateGLLock = false;
503#else
504 //if (!isCurrentWidget()) return; //G.Barrand: Qt must know if it has to activate paintGL() if the widget is not visible.
505 //G.Barrand: don't do any change in the GUI here, just ask to "paint" this widget!
506 update();
507#endif
508}
void updateViewerPropertiesTableWidget()

Referenced by DrawView().

◆ wheelEvent()

void G4OpenGLStoredQtViewer::wheelEvent ( QWheelEvent * event)
protected

Definition at line 443 of file G4OpenGLStoredQtViewer.cc.

444{
445 G4wheelEvent(event);
446}
void G4wheelEvent(QWheelEvent *event)

The documentation for this class was generated from the following files: