Friendiqa/source-android/qml/calendarqml/CalendarDay.qml

48 lines
1.4 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 1.4
Item {
id: calendarDay
width:7*mm
height: 7*mm
property int dateInt:Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
Rectangle {
id: placeHolder
color: 'lightblue'; antialiasing: true
anchors.fill:parent
}
Text {
id:daytext
anchors.right: parent.right
anchors.margins: 0.5*mm
color:(model.month==monthgrid.month)?"black":"grey"
wrapMode: Text.WrapAnywhere
text: model.day
font.bold: model.today
font.pixelSize: 4*mm
}
Rectangle {
id:eventRect
color:"black"
anchors.margins: 0.5*mm
anchors.bottom: calendarDay.bottom
width: parent.width-mm
height: mm
visible: eventdays.indexOf(dateInt)>-1
}
MouseArea {
anchors.fill: calendarDay
onClicked: {
var eventDate=[];
var idx = eventdays.indexOf(dateInt);
while (idx != -1) {
eventDate.push(idx);
idx = eventdays.indexOf(dateInt,idx + 1)
}
var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
if (component.status== Component.Ready){
var eventlist = component.createObject(calendartab,{"daylist": eventDate})}
}
}
}