D15309: [Calendar] Wrap day name index around

Chris Holland noreply at phabricator.kde.org
Thu Sep 6 23:23:08 BST 2018


Zren added a comment.


  Nice thinking on using `repeater.count` instead of the hardcoded `7`!
  
  Hmm, was worried `days.count` would trigger `onCountChanged` every time a delegate is made (count=1, count=2, etc), but it seems that the `delegate.text` is only calculated twice (delegate creation and after onCountChanged=7).
  For reference, before the patch, it only calculates the `delegate.text` once. Using a hardcoded `7` 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.
  
  Thanks for doing the patch broulik.
  
    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
  
  
  
    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
            }

REPOSITORY
  R242 Plasma Framework (Library)

REVISION DETAIL
  https://phabricator.kde.org/D15309

To: broulik, #plasma, Zren
Cc: safaalfulaij, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180906/197c7d66/attachment.html>


More information about the Kde-frameworks-devel mailing list