<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/128191/">https://git.reviewboard.kde.org/r/128191/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On June 15th, 2016, 11:59 a.m. UTC, <b>Christoph Feck</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Does it also need updates to KF5::DesignerPlugin?</pre>
</blockquote>
<p>On June 15th, 2016, 12:13 p.m. UTC, <b>Elvis Angelaccio</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Hmm, I didn't even know about this plugin when I did my test. In <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">kde.widgets</code> I see:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># KWidgetsAddons</span>
<span style="color: #008000; font-weight: bold">[KCapacityBar]</span>
<span style="color: #7D9029">IncludeFile</span><span style="color: #666666">=</span><span style="color: #BA2121">kcapacitybar.h</span>
<span style="color: #7D9029">ToolTip</span><span style="color: #666666">=</span><span style="color: #BA2121">Capacity Bar (KDE)</span>
<span style="color: #7D9029">ConstructorArgs</span><span style="color: #666666">=</span><span style="color: #BA2121">(KCapacityBar::DrawTextOutline, parent)</span>
<span style="color: #7D9029">Group</span><span style="color: #666666">=</span><span style="color: #BA2121">Display (KDE)</span>
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">and now I'm wondering why Qt Designer ignores the first argument when it generates the constructor call...</p></pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I investigated a bit more and the <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">uic</code> tool always creates custom widgets using <a href="https://code.woboq.org/qt5/qtbase/src/tools/uic/cpp/cppwriteinitialization.cpp.html#626" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">a single-argument constructor</a> (with the widget's parent):</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">m_output <span style="color: #666666"><<</span> m_indent <span style="color: #666666"><<</span> varName <span style="color: #666666"><<</span> <span style="color: #BA2121">" = new "</span> <span style="color: #666666"><<</span> m_uic<span style="color: #666666">-></span>customWidgetsInfo()<span style="color: #666666">-></span>realClassName(className) <span style="color: #666666"><<</span> <span style="color: #BA2121">'('</span> <span style="color: #666666"><<</span> parentWidget <span style="color: #666666"><<</span> <span style="color: #BA2121">");</span><span style="color: #BB6622; font-weight: bold">\n</span><span style="color: #BA2121">"</span>;
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">In fact, there are multiple widgets affected by this problem (for example KMultiTabBar)...</p></pre>
<br />
<p>- Elvis</p>
<br />
<p>On June 15th, 2016, 10:19 a.m. UTC, Elvis Angelaccio wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for KDE Frameworks and Christoph Feck.</div>
<div>By Elvis Angelaccio.</div>
<p style="color: grey;"><i>Updated June 15, 2016, 10:19 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kwidgetsaddons
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Currently KCapacityBar doesn't seem to be usable from Qt Designer (unless I'm doing something wrong).
The class has only an explicit multi-argument constructor, but Qt Designer generates something like:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">capacityBar <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> KCapacityBar(widget_3);
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">which fails to compile because there is no explicit conversion from <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">QWidget*</code> to <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">KCapacityBar::DrawTextMode</code>:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">error<span style="color: #666666">:</span> no matching constructor <span style="color: #008000; font-weight: bold">for</span> initialization of <span style="color: #BA2121">'KCapacityBar'</span>
capacityBar <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> <span style="color: #B00040">KCapacityBar</span><span style="color: #666666">(</span>widget_3<span style="color: #666666">);</span>
<span style="color: #666666">^</span> <span style="color: #666666">~~~~~~~~</span>
<span style="color: #BB6688">/usr/include/KF5/KWidgetsAddons/</span>kcapacitybar<span style="color: #666666">.</span><span style="color: #7D9029">h</span><span style="color: #666666">:44:29:</span> note<span style="color: #666666">:</span> candidate constructor <span style="color: #666666">(</span>the implicit copy constructor<span style="color: #666666">)</span> not viable<span style="color: #666666">:</span> no known conversion from
<span style="color: #BA2121">'QWidget *'</span> to <span style="color: #BA2121">'const KCapacityBar'</span> <span style="color: #008000; font-weight: bold">for</span> <span style="color: #666666">1</span>st argument
<span style="color: #008000; font-weight: bold">class</span> KWIDGETSADDONS_EXPORT KCapacityBar
<span style="color: #666666">^</span>
<span style="color: #BB6688">/usr/include/KF5/KWidgetsAddons/</span>kcapacitybar<span style="color: #666666">.</span><span style="color: #7D9029">h</span><span style="color: #666666">:72:14:</span> note<span style="color: #666666">:</span> candidate constructor not viable<span style="color: #666666">:</span> no known conversion from <span style="color: #BA2121">'QWidget *'</span> to
<span style="color: #BA2121">'KCapacityBar::DrawTextMode'</span> <span style="color: #008000; font-weight: bold">for</span> <span style="color: #666666">1</span>st argument
explicit KCapacityBar<span style="color: #666666">(</span>DrawTextMode drawTextMode <span style="color: #666666">=</span> DrawTextOutline<span style="color: #666666">,</span> QWidget <span style="color: #666666">*</span>parent <span style="color: #666666">=</span> <span style="color: #666666">0);</span>
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This patch simply adds another constructor with a single argument (the pointer to the parent).</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">KCapacityBar can now be used in a Qt Designer custom widget.</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>src/kcapacitybar.h <span style="color: grey">(1a1f2e60f415904d6cf603a4b4e0cae1c543169a)</span></li>
<li>src/kcapacitybar.cpp <span style="color: grey">(ecd2c13feb88f5c9e92086639bff48c6d0527779)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/128191/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>