<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Clint,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;I just took a quick look at the QVTKInteractor class (currently defined inside the QVTKWidget source files).&nbsp;</div><div><br></div><div>Here are some initial thoughts.</div><div><br></div><div><b><span class="Apple-style-span" style="text-decoration: underline;">QVTKInteractor Specifications</span></b></div><div><br></div><div>The new QVTKInteractor class should work with a QGraphicsView. One should be able to perform off-screen rendering using VTK in off-screen mode and render VTK images in a QGraphicsScene contained in a QGraphicsView. The QGraphicsScene will take care of rendering QTWidgets on top of the VTK generated OpenGL images. The QVTKInteractor class shall be derived from vtkRenderWindowInteractor, and be able to process mouse movements from the QGraphicsView.</div><div><br></div><div><b><span class="Apple-style-span" style="text-decoration: underline;">QVTKInteractor Design</span></b></div><div><br></div><div><b>QVTKInteractor::SetGraphicsView(QGraphicsView* ) method</b></div><div><br></div><div>In terms of design, the QVTKInteractor should be able to attach itself to a QGraphicsView via a SetGraphicsView(QGraphicsView* ) method.&nbsp;</div><div><br></div><div>I am not going to implement the vtkSetRenderWindow(vtkRenderWindow* ) method since we don't have a vtkRenderWindow here when using a framebuffer object, plus it is the wrong place to attach an interactor, since all the interaction is going to take place in the view and not the vtkRenderWindow.</div><div><br></div><div><b>Signals &amp; Slots</b></div><div><br></div><div>Implement signals within the view (a QGrahicsView subclass), so that a signal will be emitted whenever a mouse event occurs.<a href="http://doc.trolltech.com/4.4/signalsandslots.html" style=""><font class="Apple-style-span" color="#000000" style=""><span class="Apple-style-span" style="text-decoration: none;">&nbsp;See:&nbsp;</span></font></a><a href="http://doc.trolltech.com/4.4/signalsandslots.html">Qt 4.4.3: Signals and Slots</a></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">Q_SIGNALS:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; </span>// Description:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; </span>// This signal will be emitted whenever a mouse event occurs</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; </span>// within the QVTK window</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; <span style="color: #aa0d91">void</span> mouseEvent(QMouseEvent* event);</div></div><div><br></div><div>Implement a slot in QVTKInteractor to handle mouse events. This will need to internally interface with VTK.&nbsp;</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">public</span> Q_SLOTS:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp;</span>// Description:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp;</span>// This slot will be automatically invoked whenever a mouse event occurs</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="font: 12.0px Helvetica">&nbsp; </span><span style="color: #aa0d91">void</span> mouseEvent();<span style="font: 12.0px Helvetica">&nbsp;<span class="Apple-tab-span" style="white-space:pre">        </span></span></div><div><br></div></div><div><br></div><div><b>Question 01: </b>I was wondering if I should internally pass these commands to the off screen vtkRenderWindow instance? Suppose at some point, I do get rid of the un-necessary vtkRenderWindow, when performing off-screen rendering, can I still pass interactor events to VTK to interact with the VTK scene, in off-screen mode?&nbsp;</div><div><br></div><div><br></div><div><b><span class="Apple-style-span" style="text-decoration: underline;">Summary</span></b></div><div><br></div><div>In terms of usage, one would need to subclass from QGraphicsView and emit a signal on mouse move.&nbsp;</div><div><br></div><div>The QVTKInteractor associated with the QGraphicsView will process the mouse movements using its slot, and send these commands to the off-screen vtk OpenGL rendering context.&nbsp;</div><div><br></div><div>It seems a pretty straightforward design. It has the advantage of being loosely coupled and strongly typed at the same time, using the Qt signals and slots mechanism.&nbsp;</div><div><br></div><div>I was wondering if this approach seems okay to you, and if I can proceed ahead with realizing a preliminary prototype?&nbsp;</div><div><br></div><div>Do also let me know if I have missed somethings here.&nbsp;</div><div><br></div><div>Admittedly, I am trying to keep the initial functionality to a minimum and not considering QVTKWidget compatibility in the first go. Once I have completed the integration with a QGraphicsView, then same parts can be adapted for QVTKWidget, and expose this class in a separate QVTKInteractor.h and QVTKInteractor.cpp file.</div><div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>Elvis Dowson</div><div><br></div><br><div><div>On Oct 22, 2008, at 8:19 PM, <a href="mailto:clinton@elemtech.com">clinton@elemtech.com</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>I'm guessing you should be able to set up an interactor like you normally <br>would. &nbsp;The only missing piece is taking mouse events from the QGraphicsView <br>and passing them off to the interactor. &nbsp;You can look at QVTKWidget.cxx for <br>how to pass them off to the interactor. &nbsp;Getting mouse events from the <br>QGraphicsView is another part of the issue.<br><br>If you'd like to experiment, you can try modifying the QVTKInteractor to do <br>event filtering on the QVTKWidget and pass events to the interactor. &nbsp;That <br>would mean moving all the handing of mouse and key events from QVTKWidget <br>into QVTKInteractor. &nbsp;Then you might be able to use that new QVTKInteractor <br>with the QGraphicsView. &nbsp;If it works well, then this is something that can go <br>into VTK.<br><br>Clint<br><br></div></blockquote></div></body></html>