<table><tr><td style="">dfaure requested changes to this revision.<br />dfaure added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18380">View Revision</a></tr></table><br /><div><div><p>I didn't read the full encyclopedia of discussions here, I only looked at the patch.</p>
<p>But really, this is far too hacky to my taste. If QHeaderview is indeed missing a feature, it might be best to implement it there, it will be much cleaner.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-118495">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:52</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">auto</span> <span class="n">pw</span> <span style="color: #aa2211">=</span> <span class="n">view</span><span style="color: #aa2211">-></span><span class="n">parentWidget</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">for</span> <span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">pn</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> <span class="n">pw</span> <span style="color: #aa2211">&&</span> <span class="n">pn</span> <span style="color: #aa2211"><</span> <span style="color: #601200">3</span><span class="p">;</span> <span style="color: #aa2211">++</span><span class="n">pn</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">pw</span> <span style="color: #aa2211">=</span> <span class="n">pw</span><span style="color: #aa2211">-></span><span class="n">parentWidget</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is a horrible hack, relying on the exact number of parents before getting to KFileWidget.<br />
Either cast inside a while loop (i.e. "go up until a KFileWidget"), or find a way to pass the proper pointer to this class.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-118496">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:79</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">virtual</span> <span class="n">QSize</span> <span class="n">sectionSizeFromContents</span><span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">logicalIndex</span><span class="p">)</span> <span style="color: #aa4000">const</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">use override, not virtual</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-118498">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:185</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">headerView</span><span style="color: #aa2211">-></span><span class="n">setSectionResizeMode</span><span class="p">(</span><span style="color: #601200">0</span><span class="p">,</span> <span class="n">QHeaderView</span><span style="color: #aa2211">::</span><span class="n">Stretch</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">headerView</span><span style="color: #aa2211">-></span><span class="n">setSectionResizeMode</span><span class="p">(</span><span style="color: #601200">1</span><span class="p">,</span> <span class="n">QHeaderView</span><span style="color: #aa2211">::</span><span class="n">ResizeToContents</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Why is this (and the following 12 lines or so) done on every resize? Surely that's not needed?</p>
<p style="padding: 0; margin: 8px;">Split this into case Resize and case Polish, I don't see even one line of code that needs to be in both.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-118499">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:214</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">break</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">case</span> <span class="n">QEvent</span><span style="color: #aa2211">::</span><span style="color: #a0a000">Paint</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #74777d">// event analysis confirms that the 1st paint event arrives after all headers have</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">URGGH. This smells like a horrible hack. Widgets do layouting, and then painting. Modifying layouting parameters (hiding columns, resizing columns...) at painting time is very wrong and a recipe for infinite loops (paint -> layout -> paint -> layout...).</p>
<p style="padding: 0; margin: 8px;">The comment talks about a "first paint event" - if that's all you need, then at least add a static bool so that this code is run only once. But I still won't like it very much. Isn't that what Polish is for?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-118500">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:260</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">headerView</span><span style="color: #aa2211">-></span><span class="n">m_currentColumnWidth</span><span class="p">[</span><span style="color: #601200">0</span><span class="p">]</span> <span style="color: #aa2211">></span> <span style="color: #601200">0</span> <span style="color: #aa2211">&&</span> <span class="n">headerView</span><span style="color: #aa2211">-></span><span class="n">sectionResizeMode</span><span class="p">(</span><span style="color: #601200">0</span><span class="p">)</span> <span style="color: #aa2211">!=</span> <span class="n">QHeaderView</span><span style="color: #aa2211">::</span><span class="n">Interactive</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">qWarning</span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"!!!"</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">If you mean Q_ASSERT, use Q_ASSERT. If on the other hand, it can happen for good reasons, remove the qWarning.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D18380#inline-102060">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ngraham</span> wrote in <span style="color: #4b4d51; font-weight: bold;">kdiroperatordetailview.cpp:296</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">This is almost always wrong. Can you explain why you think it's required here?</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Yeah, this is correct when defining a class with Q_OBJECT in the cpp file. The moc code needs to see the class definition, and the only way to do that is to include the moc.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18380">https://phabricator.kde.org/D18380</a></div></div><br /><div><strong>To: </strong>rjvbb, ngraham, Frameworks, Dolphin, apol, dfaure, ahartmetz, markg<br /><strong>Cc: </strong>markg, cfeck, dhaumann, kwrite-devel, kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>