<table><tr><td style="">anthonyfieroni 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/D16721">View Revision</a></tr></table><br /><div><div><p>Can you test my suggestions, it's looks good to me.</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/D16721#inline-91133">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ognarb</span> wrote in <span style="color: #4b4d51; font-weight: bold;">KoToolBoxDocker.cpp:39</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">I found out that this QLabel is, it's the small draggable zone at the top of the docker. Actual it's still a bit buggy in krita and karbon <a href="https://phabricator.kde.org/F6397172" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">F6397172: krita_toolbar_to.png</a>. I should fix this before commiting. :D</p>
<p style="padding: 0; margin: 8px;">Edit: It's not a bug, it's a feature :D If I try to center the label, it's look a lot less good looking then not zooming on it. I added a small comment for future reference. :)</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Please remove label and return KoDockWidgetTitleBar it looks better.</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/D16721#inline-91331">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:221-228</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: #74777d">// Prefer showing two rows/columns by default</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QSize</span> <span class="n">twoIcons</span> <span style="color: #aa2211">=</span> <span class="n">static_cast</span><span style="color: #aa2211"><</span><span class="n">Section</span><span style="color: #aa2211">*></span> <span class="p">(</span><span class="n">m_sections</span><span class="p">[</span><span style="color: #601200">0</span><span class="p">]</span><span style="color: #aa2211">-></span><span class="n">widget</span><span class="p">())</span><span style="color: #aa2211">-></span><span class="n">iconSize</span><span class="p">()</span> <span style="color: #aa2211">*</span> <span style="color: #601200">2</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">length</span> <span style="color: #aa2211">=</span> <span class="n">doLayout</span><span class="p">(</span><span class="n">QRect</span><span class="p">(</span><span class="n">QPoint</span><span class="p">(),</span> <span class="n">twoIcons</span><span class="p">),</span> <span style="color: #304a96">false</span><span class="p">);</span>
</div><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">m_orientation</span> <span style="color: #aa2211">==</span> <span class="n">Qt</span><span style="color: #aa2211">::</span><span class="n">Vertical</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 style="color: #aa4000">return</span> <span class="n">QSize</span><span class="p">(</span><span class="n">twoIcons</span><span class="p">.</span><span class="n">width</span><span class="p">(),</span> <span class="n">length</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">return</span> <span class="n">QSize</span><span class="p">(</span><span class="n">length</span><span class="p">,</span> <span class="n">twoIcons</span><span class="p">.</span><span class="n">height</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Try this code</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">const QSize minSize = minimumSize();
if (!minSize.isValid()) {
return minSize;
}
if (m_orientation == Qt::Vertical) {
return QSize(minSize.width(), minSize.height() * 2 + spacing());
} else {
return QSize(minSize.height() * 2 + spacing(), minSize.width());
}</pre></div></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/D16721#inline-91335">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:270</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(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #74777d"><span class="bright">// nothing to do?</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_sections</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">isEmpty</span></span><span class="bright"></span><span class="p"><span class="bright">())</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span class="n"><span class="bright">QLayout</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">setGeometry</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">rect</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="bright"></span><span class="n"><span class="bright">doLayout</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">rect</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span style="color: #304a96"><span class="bright">true</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></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;">We don't need rect so</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">doLayout(rect.size(), true);</pre></div></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/D16721#inline-91333">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:281-282</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">m_orientation</span> <span style="color: #aa2211">==</span> <span class="n">Qt</span><span style="color: #aa2211">::</span><span class="n">Vertical</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 style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">height</span> <span style="color: #aa2211">=</span> <span class="n">doLayout</span><span class="p">(</span><span class="n">QRect</span><span class="p">(</span><span style="color: #601200">0</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">,</span> <span class="n">width</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">),</span> <span style="color: #304a96">false</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">return</span> <span class="n">height</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">return doLayout(QSize(width, 0), false);</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/D16721#inline-91334">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:296-297</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">m_orientation</span> <span style="color: #aa2211">==</span> <span class="n">Qt</span><span style="color: #aa2211">::</span><span class="n">Horizontal</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 style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">width</span> <span style="color: #aa2211">=</span> <span class="n">doLayout</span><span class="p">(</span><span class="n">QRect</span><span class="p">(</span><span style="color: #601200">0</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">,</span> <span class="n">height</span><span class="p">),</span> <span style="color: #304a96">false</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">return</span> <span class="n">width</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">return doLayout(QSize(0, height), false);</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/D16721#inline-91336">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:310</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: #a0a000">private</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">int</span> <span class="n">doLayout</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QRect</span> <span style="color: #aa2211">&</span><span class="n">rect</span><span class="p">,</span> <span style="color: #aa4000">bool</span> <span class="n">notDryRun</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;">Rename notDryRun to applyGeometry</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/D16721#inline-91337">View Inline</a><span style="color: #4b4d51; font-weight: bold;">KoToolBoxLayout_p.h:333</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; "> <span style="color: #aa4000">bool</span> <span class="n">firstSection</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">true</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">foreach</span> <span class="p">(</span><span class="n">QWidgetItem</span> <span style="color: #aa2211">*</span><span class="n">wi</span><span class="p">,</span> <span class="n">m_sections</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">Section</span> <span style="color: #aa2211">*</span><span class="n">section</span> <span style="color: #aa2211">=</span> <span class="n">static_cast</span><span style="color: #aa2211"><</span><span class="n">Section</span><span style="color: #aa2211">*></span> <span class="p">(</span><span class="n">wi</span><span style="color: #aa2211">-></span><span class="n">widget</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #74777d">// Since sections can overlap (if a section occupies two rows, and there</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #74777d">// is space on the second row for all of the next section, the next section</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #74777d">// will be placed overlapping with the previous section), it's important that</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #74777d">// later sections will be higher in the widget z-order than previous</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span style="color: #74777d">// sections, so raise it.</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="n">section</span><span style="color: #aa2211">-></span><span class="n">raise</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I prefer to be 2 distinct loops</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (!applyGeometry) {
foreach (QWidgetItem *wi, m_sections) {
Section *section = static_cast<Section*> (wi->widget());
const int buttonCount = section->visibleButtonCount();
if (buttonCount == 0) {
continue;
}
// rows needed for the buttons (calculation gets the ceiling value of the plain div)
const int neededRowCount = ((buttonCount - 1) / maxColumns) + 1;
if (firstSection) {
firstSection = false;
} else {
// start on a new row, set separator
y += iconHeight + spacing();
}
// advance by all but the last used row
y += (neededRowCount - 1) * iconHeight;
}
return y + iconHeight;
}</pre></div>
<p style="padding: 0; margin: 8px;">and other one without notDryRun.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R8 Calligra</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16721">https://phabricator.kde.org/D16721</a></div></div><br /><div><strong>To: </strong>ognarb, Krita, Calligra: 3.0<br /><strong>Cc: </strong>anthonyfieroni, Calligra-Devel-list, dcaliste, cochise, vandenoever<br /></div>