<div dir="ltr"><div><div><div>Hi all,<br><br></div>I have an issue with QMainWindow when using a QVTKWidget as the centralwidget. Both the Toolbars and DockWidgets get messed up, meaning that for some toolbar elements get unclickable after some reordering of the elements, and moving DockWidgets causes a large white square to appear.<br><br></div>The following snippet produces a white square over the window when attempting to dock DockWidget "B" onto Dockwidget "A":<br></div><div>(A full compiling version is also available at <a href="https://github.com/christiana/issue1044">https://github.com/christiana/issue1044</a>)<br></div><div><br></div>main.cpp:<br><div><br>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">main</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argc</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">argv</span><span style="color:rgb(0,0,0)">[])</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QApplication</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">app</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">argc</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argv</span><span style="color:rgb(0,0,0)">);</span></pre><br><pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">window</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">window</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">resize</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">800</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">500</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">window</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">show</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin:0px;text-indent:0px"><br></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">app</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">exec</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,0)">}<br><br></span>MainWindow.cpp:
<span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">MainWindow</span><span style="color:rgb(0,0,0)">()</span>
<span style="color:rgb(0,0,0)">{</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QVTKWidget</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QVTKWidget</span><span style="color:rgb(0,0,0)">();</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setCentralWidget</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(0,0,0)">);</span><br>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">The</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">hidden</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">toolbar</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">makes</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">bug</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">more</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">obvious.</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Without</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">this</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">drag/drop</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">QDockWidgets</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">is</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">still</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">messed</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">up.</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addHiddenToolbar</span><span style="color:rgb(0,0,0)">();</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">drag</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">A</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">on</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">top</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">of</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">B</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">white</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">square</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">appears</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">(if</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">already</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">present</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">at</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">startup)</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addDock</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"A"</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addDock</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"B"</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(0,0,0)">}</span>
<span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">addHiddenToolbar</span><span style="color:rgb(0,0,0)">()</span>
<span style="color:rgb(0,0,0)">{</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QToolBar</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">toolbar</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QToolBar</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"FooBar"</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addToolBar</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">toolbar</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">toolbar</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">hide</span><span style="color:rgb(0,0,0)">();</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">toolbar</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addAction</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"Foo"</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(0,0,0)">}</span>
<span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">addDock</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">QString</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">name</span><span style="color:rgb(0,0,0)">)</span>
<span style="color:rgb(0,0,0)">{</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QDockWidget</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dockWidget</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QDockWidget</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">name</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dockWidget</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setWidget</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QLabel</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">name</span><span style="color:rgb(0,0,0)">));</span>
<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">addDockWidget</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">Qt</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">LeftDockWidgetArea</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">dockWidget</span><span style="color:rgb(0,0,0)">);</span>
<span style="color:rgb(0,0,0)">}</span>
<br></pre><pre style="margin:0px;text-indent:0px">This seems to have been present since Qt 5.0, <br>and is still there with VTK 6.3 and Qt 5.5.1.<br></pre><pre style="margin:0px;text-indent:0px">Mac only (OSX10.8-10.11).<br><br></pre><pre style="margin:0px;text-indent:0px">I'll continue working on this issue, but any tips and comments are<br></pre><pre style="margin:0px;text-indent:0px">very welcome.<br></pre><pre style="margin:0px;text-indent:0px"><br></pre><pre style="margin:0px;text-indent:0px">Best,<br><br></pre><pre style="margin:0px;text-indent:0px">Christian<br></pre><br></div></div>