<table><tr><td style="">rkflx updated this revision to Diff 19345.<br />rkflx edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-xbrdde2i6onxd4m/" rel="noreferrer">(Show Details)</a><br />rkflx 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/D7164" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Spent some time trying to solve this properly, but it's difficult.</p>

<p>We could get the Qt code as LGPLv2.1 from an older release, and <tt style="background: #ebebeb; font-size: 13px;">relicensecheck.pl</tt> for ksqueezedtextlabel.{cpp,h} on kwidgetsaddons and kdelibs (including moves) doesn't look too bad for "lgplv23 lgplv2+". However, technically we would need to relicense to either "v3" or "v2.1", but the script only asks for "v2 or v3" and "v2+". Thus, no luck.</p>

<p>Therefore, I opened the Qt API docs to check whether a reimplementation without looking at the code is possible, which states already quite algorithmically:</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 indent is negative, or if no indent has been set, the label computes the effective indent as follows: If frameWidth() is 0, the effective indent becomes 0. If frameWidth() is greater than 0, the effective indent becomes half the width of the "x" character of the widget's current font(). By default, the indent is -1, meaning that an effective indent is calculating in the manner described above.</pre></div>

<p>The implementation I'm proposing (as of now :) should be doing exactly that, of course with adaptations to also account for margin and lineWidth. Let me know if this is enough.</p></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><div style="padding: 8px 0;">...</div>width and when returning the size hint<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">. For this, the relevant<br />
implementation from QLabel is used</span>.<div style="padding: 8px 0;">...</div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R236 KWidgetsAddons</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D7164?vs=19332&id=19345" rel="noreferrer">https://phabricator.kde.org/D7164?vs=19332&id=19345</a></div></div><br /><div><strong>BRANCH</strong><div><div>arcpatch-D7164 (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7164" rel="noreferrer">https://phabricator.kde.org/D7164</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/ksqueezedtextlabelautotest.cpp<br />
src/ksqueezedtextlabel.cpp<br />
src/ksqueezedtextlabel.h</div></div></div><br /><div><strong>To: </strong>rkflx, Frameworks, cfeck<br /><strong>Cc: </strong>cfeck, dhaumann<br /></div>