<table><tr><td style="">kossebau 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/D26320">View Revision</a></tr></table><br /><div><div><p>Ah, I looked at the "dev" branch only and missed that it is possibly already pre-Qt6, no longer base for any future Qt5 branches, right?<br />
Indeed things look differently in the 5.15 branch, where the old variant is tagged deprecated, I now see.</p>

<p>Have to tell that I am bit unhappy about what Qt devs are forcing us here into then, only because we also want to support versions < 5.15:<br />
assuming that all those <tt style="background: #ebebeb; font-size: 13px;">end</tt> usages are correct and preferred, this code here once ported to Qt6 should simply use <tt style="background: #ebebeb; font-size: 13px;">Qt::endl</tt> again, right?<br />
The only reason we do these changes here is to avoid deprecation warnings.<br />
And I agree that doing any <tt style="background: #ebebeb; font-size: 13px;">#if QT_IS_VERSION_5_15 Qt::endl #ELSE endl #ENDIF</tt> sucks here, as there are too many instances and embedded too deep in other expressions.</p>

<p>But now simply dropping the use of <tt style="background: #ebebeb; font-size: 13px;">endl</tt> instead, so departing from a well-known C++ code pattern, into doing lots of explicit calls (<tt style="background: #ebebeb; font-size: 13px;"><< QLatin1Char('\n') + flush()</tt>) makes the code worse IMHO.</p>

<p>No other idea what to do here yet. Perhaps we could instead do an alias definition in each affected file instead, so having only one place with <tt style="background: #ebebeb; font-size: 13px;">#if QT_IS_VERSION_5_15 Qt::endl #ELSE endl #ENDIF</tt>. Like (untested sketched 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);">namespace KF {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QTextStream &endl(QTextStream &s) { return Qt::endl(s); }
#ELSE
QTextStream &endl(QTextStream &s) { return endl(s); }
#ENDIF
}

stream << "something for output" << KF::endl;</pre></div>

<p>So the current logic with the known patterns could stay, and once KF6 is created (so backward compat code can be dropped), things could be simply changed to be just <tt style="background: #ebebeb; font-size: 13px;">Qt::endl</tt>.</p>

<p>What do you think?</p>

<p>(I start to think that there are cases where having sub-version-level control about deprecations warnings would be a reasonable feature...)</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R269 BluezQt</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D26320">https://phabricator.kde.org/D26320</a></div></div><br /><div><strong>To: </strong>mlaurent, dfaure<br /><strong>Cc: </strong>kossebau, apol, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>