<table><tr><td style="">Zren 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/D15309">View Revision</a></tr></table><br /><div><div><p>Nice thinking on using <tt style="background: #ebebeb; font-size: 13px;">repeater.count</tt> instead of the hardcoded <tt style="background: #ebebeb; font-size: 13px;">7</tt>!</p>
<p>Hmm, was worried <tt style="background: #ebebeb; font-size: 13px;">days.count</tt> would trigger <tt style="background: #ebebeb; font-size: 13px;">onCountChanged</tt> every time a delegate is made (count=1, count=2, etc), but it seems that the <tt style="background: #ebebeb; font-size: 13px;">delegate.text</tt> is only calculated twice (delegate creation and after onCountChanged=7).<br />
For reference, before the patch, it only calculates the <tt style="background: #ebebeb; font-size: 13px;">delegate.text</tt> once. Using a hardcoded <tt style="background: #ebebeb; font-size: 13px;">7</tt> also only calls it once, but it's bad practice to have magic numbers. I assume it won't reattempt to render the labels since the text didn't change.</p>
<p>Thanks for doing the patch broulik.</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);">qml: days.count 0
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 0 Sun
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 1 Mon
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 2 Tue
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 3 Wed
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 4 Thu
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 5 Fri
Both point size and pixel size set. Using pixel size.
qml: days.delegate.text 6 Sat
Both point size and pixel size set. Using pixel size.
qml: days.count 7
qml: days.delegate.text 0 Sun
qml: days.delegate.text 1 Mon
qml: days.delegate.text 2 Tue
qml: days.delegate.text 3 Wed
qml: days.delegate.text 4 Thu
qml: days.delegate.text 5 Fri
qml: days.delegate.text 6 Sat</pre></div>
<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);">Repeater {
id: days
onCountChanged: console.log('days.count', count)
Components.Label {
text: {
var s = Qt.locale(Qt.locale().uiLanguages[0]).dayName((calendarBackend.firstDayOfWeek + index) % 7, Locale.ShortFormat)
console.log('days.delegate.text', index, s)
return s
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R242 Plasma Framework (Library)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15309">https://phabricator.kde.org/D15309</a></div></div><br /><div><strong>To: </strong>broulik, Plasma, Zren<br /><strong>Cc: </strong>safaalfulaij, kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>