46 + property bool shouldCreateHighlight: date.isSameDay(DateExt.today()) && isCurrentMonth 47 + 48 + onShouldCreateHighlightChanged: { 49 + if( shouldCreateHighlight ) { 50 + highlightLoader.sourceComponent = highLightComp; 51 + } else { 52 + //unloading the highlight 53 + highlightLoader.sourceComponent = undefined 54 + } 55 + }
This is better, but it can be taken one step further to make it fully declarative: remove entirely the shouldCreateHighlight property, and do this:
Loader { sourceComponent: date.isSameDay(DateExt.today()) && isCurrentMonth ? highLightComp : undefined […] }
(and you can then remove the 'highlightLoader' id which will be unused).
« Back to merge proposal
46 + property bool shouldCreateHig hlight: date.isSameDay( DateExt. today() ) && isCurrentMonth ighlightChanged : { hlight ) { .sourceComponen t = highLightComp; .sourceComponen t = undefined
47 +
48 + onShouldCreateH
49 + if( shouldCreateHig
50 + highlightLoader
51 + } else {
52 + //unloading the highlight
53 + highlightLoader
54 + }
55 + }
This is better, but it can be taken one step further to make it fully declarative: remove entirely the shouldCreateHig hlight property, and do this:
Loader {
sourceComponen t: date.isSameDay( DateExt. today() ) && isCurrentMonth ? highLightComp : undefined
[…]
}
(and you can then remove the 'highlightLoader' id which will be unused).