33 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER
40 #include <qapplication.h>
42 G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer
43 (G4OpenGLImmediateSceneHandler& sceneHandler,
45 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
46 G4OpenGLViewer (sceneHandler),
47 G4OpenGLQtViewer (sceneHandler),
48 G4OpenGLImmediateViewer (sceneHandler)
51 setFocusPolicy(Qt::StrongFocus);
52 fHasToRepaint =
false;
53 fIsRepainting =
false;
55 resize(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
57 if (fViewId < 0)
return;
60 G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer() {
64 void G4OpenGLImmediateQtViewer::Initialise() {
65 #ifdef G4DEBUG_VIS_OGL
66 printf(
"G4OpenGLImmediateQtViewer::Initialise \n");
68 fReadyToPaint =
false;
69 CreateMainWindow (
this,QString(GetName()));
75 void G4OpenGLImmediateQtViewer::initializeGL () {
83 if (fSceneHandler.GetScene() == 0) {
93 QCoreApplication::sendPostedEvents () ;
97 void G4OpenGLImmediateQtViewer::DrawView() {
102 void G4OpenGLImmediateQtViewer::ComputeView () {
104 #ifdef G4DEBUG_VIS_OGL
105 printf(
"G4OpenGLImmediateQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
121 #ifdef G4DEBUG_VIS_OGL
122 printf(
"G4OpenGLImmediateQtViewer::ComputeView First ProcessView ok\n");
124 HaloingSecondPass ();
135 #ifdef G4DEBUG_VIS_OGL
136 printf(
"G4OpenGLImmediateQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
138 fHasToRepaint =
true;
144 void G4OpenGLImmediateQtViewer::resizeGL(
148 if ((aWidth > 0) && (aHeight > 0)) {
149 ResizeWindow(aWidth,aHeight);
150 fHasToRepaint = sizeHasChanged();
155 void G4OpenGLImmediateQtViewer::paintGL()
157 updateToolbarAndMouseContextMenu();
162 if (!fReadyToPaint) {
166 if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
171 if ( !fHasToRepaint) {
176 if (!isMaximized() && !isFullScreen()) {
177 sw = normalGeometry().width();
178 sh = normalGeometry().height();
180 sw = frameGeometry().width();
181 sh = frameGeometry().height();
183 if ((getWinWidth() == (
unsigned int)sw) &&(getWinHeight() == (
unsigned int)sh)) {
186 }
else if ((sw == 0) && (sh == 0)) {
187 if (((getWinWidth() == (
unsigned int)
width())) &&(getWinHeight() == (
unsigned int) height())) {
192 #ifdef G4DEBUG_VIS_OGL
193 printf(
"G4OpenGLImmediateQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
201 fHasToRepaint =
false;
203 #ifdef G4DEBUG_VIS_OGL
204 printf(
"G4OpenGLImmediateQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n\n\n",fReadyToPaint);
206 fIsRepainting =
false;
209 void G4OpenGLImmediateQtViewer::mousePressEvent(QMouseEvent *event)
211 G4MousePressEvent(event);
214 void G4OpenGLImmediateQtViewer::keyPressEvent (QKeyEvent * event)
216 G4keyPressEvent(event);
219 void G4OpenGLImmediateQtViewer::wheelEvent (QWheelEvent * event)
224 void G4OpenGLImmediateQtViewer::showEvent (QShowEvent *)
226 fHasToRepaint =
true;
234 void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(QMouseEvent *)
236 G4MouseDoubleClickEvent();
239 void G4OpenGLImmediateQtViewer::mouseReleaseEvent(QMouseEvent *)
241 G4MouseReleaseEvent();
244 void G4OpenGLImmediateQtViewer::mouseMoveEvent(QMouseEvent *event)
246 G4MouseMoveEvent(event);
250 void G4OpenGLImmediateQtViewer::contextMenuEvent(QContextMenuEvent *e)
252 G4manageContextMenuEvent(e);
255 void G4OpenGLImmediateQtViewer::paintEvent(QPaintEvent *) {
256 if ( fHasToRepaint) {
262 void G4OpenGLImmediateQtViewer::updateQWidget() {
266 fHasToRepaint=
false;
270 void G4OpenGLImmediateQtViewer::ShowView (
275 fHasToRepaint =
true;
printf("%d Experimental points found\n", nlines)