Hi Doug, <div><br></div><div>thanks for your reply. I&#39;ve been able to figure this out myself, according to Murphy&#39;s Law of Support Mailing Lists (Despite having spent two weeks on one problem, you only get to solve it right after asking for help in the appropriate mailing list).</div>

<div><br></div><div>The solution seems to be to add the qvtkWidget to a separate QWidget, which acts as a window. There were two problems: 1) qvtkWidget&#39;s parent should be the widget I&#39;m summoning to act as separate window. 2) In the QWidget&#39;s creator, the flags should be adjusted to something sensible, i.e. Qt::Dialog. I had them set as Qt::Window.</div>

<div><br></div><div>Thanks!</div><div><br></div><div>Jon<br><br><div class="gmail_quote">2012/1/31 Doug Hoppes <span dir="ltr">&lt;<a href="mailto:dhoppes@mbfbioscience.com">dhoppes@mbfbioscience.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Jon,<u></u><u></u></span></p><p class="MsoNormal">

<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">                <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">                I don’t have time right now, but I can take a look at this later.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">                A couple of questions:<u></u><u></u></span></p>

<p style="margin-left:.75in"><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><span>1)<span style="font:7.0pt &quot;Times New Roman&quot;">      </span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Can you set the vtk widget to the main windows central widget?  <u></u><u></u></span></p>

<p style="margin-left:.75in"><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><span>2)<span style="font:7.0pt &quot;Times New Roman&quot;">      </span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">For the other window, are you using a docking window (QDockWidget) or QDialog?<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Dougie<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>] <b>On Behalf Of </b>Jon Agirre<br>

<b>Sent:</b> Tuesday, January 31, 2012 4:19 AM<br><b>To:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br><b>Subject:</b> [vtkusers] qvtkWidget as separate window<u></u><u></u></span></p><div>

<div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Dear friends,<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I&#39;m trying to make an application that should be able to summon a separate 3D graphics window from its main window. As for the UI design, I&#39;ve chosen QT 4 in cooperation with VTK. Despite being familiar with the simpleview qvtkWidget example, I haven&#39;t been able to use qvtkwidget in my QT application, at least not the way I&#39;m used to work with QWidgets. Here go the options I&#39;ve tried:<br clear="all">

<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">- qvtkWidget alone as separate window -&gt; crash. While I can create a QWidget object as a separate window, I can&#39;t do the same with qvtkwidget.<u></u><u></u></p>

</div><div><p class="MsoNormal">- qvtkWidget inserted into the layout manager of a separate QWidget, which is created to be a separate window -&gt; crash. If I do not insert it into the layout, the QWidget displays just fine. <u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The code I use for this later option is as follows:<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><pre><span style="color:silver">        </span><span style="color:maroon">qvtkWidget</span><span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:olive">new</span><span style="color:silver"> </span><span style="color:purple">QVTKWidget</span>();<u></u><u></u></pre>

<pre><span style="color:silver">        </span><span style="color:maroon">window</span><span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:olive">new</span><span style="color:silver"> </span><span style="color:purple">QWidget</span>(<span style="color:olive">this</span>,<span style="color:silver"> </span><span style="color:purple">Qt</span>::<span style="color:purple">Window</span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span><span style="color:maroon">qvtkWidget</span>-&gt;resize(<span style="color:navy">640</span>,<span style="color:navy">384</span>);<u></u><u></u></pre><pre><span style="color:silver">        </span><span style="color:purple">vtkSmartPointer</span>&lt;<span style="color:purple">vtkLight</span>&gt;<span style="color:silver"> </span>light<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:purple">vtkSmartPointer</span>&lt;<span style="color:purple">vtkLight</span>&gt;::New();<u></u><u></u></pre>

<pre><span style="color:silver">        </span>light-&gt;<i>SetFocalPoint</i>(<span style="color:silver"> </span><span style="color:navy">0.21406</span><span style="color:silver"> </span>,<span style="color:silver"> </span><span style="color:navy">1.5</span><span style="color:silver"> </span>,<span style="color:silver"> </span><span style="color:navy">0</span><span style="color:silver"> </span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>light-&gt;<i>SetPosition</i>(<span style="color:silver"> </span><span style="color:navy">8.3761</span><span style="color:silver"> </span>,<span style="color:silver"> </span><span style="color:navy">4.94858</span><span style="color:silver"> </span>,<span style="color:silver"> </span><span style="color:navy">4.12505</span><span style="color:silver"> </span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>VTK_CREATE(<span style="color:purple">vtkConeSource</span>,<span style="color:silver"> </span>cone);<u></u><u></u></pre><pre><span style="color:silver">        </span>cone-&gt;SetHeight(<span style="color:silver"> </span><span style="color:navy">3.0</span><span style="color:silver"> </span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>cone-&gt;SetRadius(<span style="color:silver"> </span><span style="color:navy">1.0</span><span style="color:silver"> </span>);<u></u><u></u></pre><pre><span style="color:silver">        </span>cone-&gt;SetResolution(<span style="color:silver"> </span><span style="color:navy">50</span><span style="color:silver"> </span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>VTK_CREATE(<span style="color:purple">vtkPolyDataMapper</span>,<span style="color:silver"> </span>coneMapper);<u></u><u></u></pre><pre><span style="color:silver">        </span>coneMapper-&gt;ImmediateModeRenderingOn();<u></u><u></u></pre>

<pre><span style="color:silver">        </span>coneMapper-&gt;SetInputConnection(<span style="color:silver"> </span>cone-&gt;GetOutputPort()<span style="color:silver"> </span>);<u></u><u></u></pre><pre><span style="color:silver">        </span><u></u><u></u></pre>

<pre><span style="color:silver">        </span>VTK_CREATE(<span style="color:purple">vtkActor</span>,<span style="color:silver"> </span>coneActor);<u></u><u></u></pre><pre><span style="color:silver">        </span>coneActor-&gt;SetMapper(coneMapper);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>VTK_CREATE(<span style="color:purple">vtkRenderer</span>,<span style="color:silver"> </span>renderer);<u></u><u></u></pre><pre><span style="color:silver">        </span>renderer-&gt;SetBackground(<span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">0</span>);<u></u><u></u></pre>

<pre><span style="color:silver">        </span>renderer-&gt;AddLight(light);<u></u><u></u></pre><pre><span style="color:silver">        </span>renderer-&gt;AddActor(coneActor);<u></u><u></u></pre><pre><u></u> <u></u></pre>

<pre><span style="color:silver">        </span><span style="color:maroon">qvtkWidget</span>-&gt;<i>GetRenderWindow</i>()-&gt;<i>AddRenderer</i>(renderer);<u></u><u></u></pre><pre><u></u> <u></u></pre><pre><span style="color:silver">        </span><span style="color:maroon">window</span>-&gt;layout()-&gt;addWidget(<span style="color:maroon">qvtkWidget</span>);<u></u><u></u></pre>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I&#39;m using Mac OS X 10.6, with QT 4 and VTK 5.6.1. The code, as you might guess, mimics the simpleview example. <u></u><u></u></p></div>

<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Any clues?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks for your time,<u></u><u></u></p>

</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Jon<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><p class="MsoNormal">

Dr. Jon Agirre<u></u><u></u></p></div><p class="MsoNormal">Postdoctoral Scientist - Protein and<br>Virus X-ray Crystallography Group<br>Biophysics Unit (CSIC-UPV/EHU)<br><a href="tel:%2B0034946013357" value="+34946013357" target="_blank">+0034946013357</a><u></u><u></u></p>

</div></div></div></div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Dr. Jon Agirre</div>Postdoctoral Scientist - Protein and<br>Virus X-ray Crystallography Group<br>Biophysics Unit (CSIC-UPV/EHU)<br>+0034946013357<br>
</div>