47 + Component.onCompleted: {
48 + mainModel.addModelChangeListener(buildList);
49 + }
50 +
51 + function buildList () {
52 + eventModel.clear();
53 + // Include all events from 00:00 so you can still consult the past events of the day
54 + // (or just you are late 10 minutes to your RDV, and you need details from the event...)
55 + var itemIds = mainModel.getItems();
56 + for(var i = 0 ; i < itemIds.length ; ++i) {
57 + var event = itemIds[(i)];
58 + if( event ) {
59 + // Recreating new ListItem model, because
60 + // 1. I'm not able to take control on section.property formating in ListView
61 + // 2. section in deledate has been cast to string (even if property was a QDateTime
62 + // 3. no way to cheat like adding on the fly a method or property to the ListItem while looping
63 + eventModel.append({
64 + sectionLabel: event.startDateTime.formatDate(),
65 + event: event
66 + });
67 + }
68 + }
69 + }
70 +
71 + ListModel {
72 + id: eventModel
73 + }
60 + // 1. I'm not able to take control on section.property formating in ListView
61 + // 2. section in deledate has been cast to string (even if property was a QDateTime
62 + // 3. no way to cheat like adding on the fly a method or property to the ListItem while looping
Why do you need cheat the section property? If the section was cast to string you can use the string to convert back to a QDateTime object using the "section" property no?
You do not need this:
47 + Component. onCompleted: { addModelChangeL istener( buildList) ; getItems( ); Time.formatDate (),
48 + mainModel.
49 + }
50 +
51 + function buildList () {
52 + eventModel.clear();
53 + // Include all events from 00:00 so you can still consult the past events of the day
54 + // (or just you are late 10 minutes to your RDV, and you need details from the event...)
55 + var itemIds = mainModel.
56 + for(var i = 0 ; i < itemIds.length ; ++i) {
57 + var event = itemIds[(i)];
58 + if( event ) {
59 + // Recreating new ListItem model, because
60 + // 1. I'm not able to take control on section.property formating in ListView
61 + // 2. section in deledate has been cast to string (even if property was a QDateTime
62 + // 3. no way to cheat like adding on the fly a method or property to the ListItem while looping
63 + eventModel.append({
64 + sectionLabel: event.startDate
65 + event: event
66 + });
67 + }
68 + }
69 + }
70 +
71 + ListModel {
72 + id: eventModel
73 + }
60 + // 1. I'm not able to take control on section.property formating in ListView
61 + // 2. section in deledate has been cast to string (even if property was a QDateTime
62 + // 3. no way to cheat like adding on the fly a method or property to the ListItem while looping
Why do you need cheat the section property? If the section was cast to string you can use the string to convert back to a QDateTime object using the "section" property no?