<div dir="ltr">Moving from the old QVTKWidget to the new QVTKOpenGLWidget, I noticed the bug, when
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">a vtkBalloonWidget was added to the </span>QVTKInteractor. When
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">QVTKOpenGLWidget object lose the focus, then it becomes black (when you move mouse over it, then all is OK again).</span><div>Video is here:</div><div><a href="https://youtu.be/aRlfiZpFFqE">https://youtu.be/aRlfiZpFFqE</a><br></div><div><br></div><div>The code to reproduce the bug:</div><div><br></div><div>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><QApplication></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><QSurfaceFormat></span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><QVTKOpenGLWidget.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkRenderer.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkGenericOpenGLRenderWindow.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkBalloonWidget.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkSphereSource.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkPolyDataMapper.h></span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">#include</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,149,69)"><vtkAutoInit.h></span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">VTK_MODULE_INIT</span><span style="color:rgb(214,187,154)">(</span>vtkInteractionStyle<span style="color:rgb(214,187,154)">)</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(255,106,173)">VTK_MODULE_INIT</span><span style="color:rgb(214,187,154)">(</span>vtkRenderingOpenGL2<span style="color:rgb(214,187,154)">)</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(214,154,167)">int</span><span style="color:rgb(190,192,194)"> </span><span style="font-weight:600">main</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,154,167)">int</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">argc</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,154,167)">char</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">*</span><span style="color:rgb(214,187,154)">argv</span><span style="color:rgb(214,187,154)">[])</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(214,187,154)">{</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">QSurfaceFormat</span><span style="color:rgb(214,187,154)">::</span>setDefaultFormat<span style="color:rgb(214,187,154)">(</span><span style="color:rgb(255,128,128)">QVTKOpenGLWidget</span><span style="color:rgb(214,187,154)">::</span>defaultFormat<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">QApplication</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">a</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">argc</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">argv</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkRenderer</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderer</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderer</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetBackground</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(138,96,44)">.3</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(138,96,44)">.6</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(138,96,44)">.3</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkGenericOpenGLRenderWindow</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderWindow</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderWindow</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">AddRenderer</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">mRenderer</span><span style="color:rgb(214,187,154)">.</span>Get<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">QVTKInteractor</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderWindowInteractor</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderWindowInteractor</span><span style="color:rgb(214,187,154)">-></span>SetRenderWindow<span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">mRenderWindow</span><span style="color:rgb(214,187,154)">.</span>Get<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkBalloonWidget</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mBalloonWidget</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mBalloonWidget</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetInteractor</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">mRenderWindowInteractor</span><span style="color:rgb(214,187,154)">.</span>Get<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mBalloonWidget</span><span style="color:rgb(214,187,154)">-></span>EnabledOn<span style="color:rgb(214,187,154)">();</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">//</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">remove</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">this</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">line</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">to</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">fix</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">the</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">bug</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">(but</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">we</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">need</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">it</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">for</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">balloons)</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">//</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">Add</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">a</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">sphere</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">for</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">beauty</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">(but</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">we</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">can</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">get</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">the</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">bug</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">without</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">any</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">actor</span><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(168,171,176)">too)</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkSphereSource</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">sphere</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">sphere</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetCenter</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(138,96,44)">0.0</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(138,96,44)">0.0</span><span style="color:rgb(214,187,154)">,</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(138,96,44)">0.0</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">sphere</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetRadius</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(138,96,44)">5.0</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkPolyDataMapper</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mapper</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mapper</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetInputConnection</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">sphere</span><span style="color:rgb(214,187,154)">-></span>GetOutputPort<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">vtkNew</span><span style="color:rgb(214,187,154)"><</span><span style="color:rgb(255,128,128)">vtkActor</span><span style="color:rgb(214,187,154)">></span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">actor</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">actor</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">SetMapper</span><span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">mapper</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderer</span><span style="color:rgb(214,187,154)">-></span>AddActor<span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">actor</span><span style="color:rgb(214,187,154)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(255,128,128)">QVTKOpenGLWidget</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">vtkOpenGlWidget</span><span style="color:rgb(214,187,154)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">vtkOpenGlWidget</span><span style="color:rgb(214,187,154)">.</span>SetRenderWindow<span style="color:rgb(214,187,154)">(</span><span style="color:rgb(214,187,154)">mRenderWindow</span><span style="color:rgb(214,187,154)">.</span>Get<span style="color:rgb(214,187,154)">());</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">vtkOpenGlWidget</span><span style="color:rgb(214,187,154)">.</span>show<span style="color:rgb(214,187,154)">();</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">mRenderWindow</span><span style="color:rgb(214,187,154)">-></span><span style="font-style:italic">Render</span><span style="color:rgb(214,187,154)">();</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(190,192,194)"> </span><span style="font-style:italic;color:rgb(69,198,214)">return</span><span style="color:rgb(190,192,194)"> </span><span style="color:rgb(214,187,154)">a</span><span style="color:rgb(214,187,154)">.</span>exec<span style="color:rgb(214,187,154)">();</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(214,187,154)">}</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre><br></div><div>Without this line:
<pre style="color:rgb(34,34,34);font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;margin:0px"><span style="color:rgb(214,187,154)">mBalloonWidget</span><span style="color:rgb(214,187,154)">-></span>EnabledOn<span style="color:rgb(214,187,154)">();</span></pre>all works good.</div><div><br></div><div>And there are no problems with old QVTKWidget, but there is this bug with new QVTKOpenGLWidget and balloons enabled.</div><div><br></div><div>Compiler is MSVC 2017 32 bit, VTK 8.1.0, Qt 5.10.1</div><div><br></div><div>The question is:</div><div>Is this a VTK bug or some my mistake?</div><div><br></div><div>-- <br><div class="gmail_signature"><div dir="ltr"><font color="#111111" face="sans-serif"><span style="font-size:13px;line-height:18.2px">Best regards,</span></font><br><div><font color="#111111" face="sans-serif"><span style="font-size:13px;line-height:18.2px">Ivan Kosik</span></font></div></div></div>
</div></div>