correct initial date setting, theming improvement

This commit is contained in:
Sebastian Kügler 2013-11-12 05:51:45 +01:00
parent 6134503899
commit 6f8d1b6ab2
2 changed files with 11 additions and 8 deletions

View File

@ -41,7 +41,7 @@ Item {
width: parent.width - (borderWidth) width: parent.width - (borderWidth)
height: parent.height - (borderWidth) height: parent.height - (borderWidth)
// anchors.fill: parent // anchors.fill: parent
opacity: (calendarDays.selectedItem == dayStyle || isToday(dayNumber+"/"+monthNumber+"/"+yearNumber)) ? 0.8 : 0 opacity: (isToday(dayNumber+"/"+monthNumber+"/"+yearNumber)) ? 0.8 : 0
Behavior on opacity { NumberAnimation {} } Behavior on opacity { NumberAnimation {} }
color: theme.highlightColor color: theme.highlightColor
//border.color: isToday(dayNumber+"/"+monthNumber+"/"+yearNumber) ? theme.highlightColor : "transparent" //border.color: isToday(dayNumber+"/"+monthNumber+"/"+yearNumber) ? theme.highlightColor : "transparent"
@ -52,10 +52,15 @@ Item {
anchors { anchors {
fill: todayRect fill: todayRect
} }
opacity: dateMouse.containsMouse ? 0.3 : 0 opacity: {
if (calendarDays.selectedItem == dayStyle) 0.6
else if (dateMouse.containsMouse) 0.3
else 0
}
//visible: dateMouse.containsMouse //visible: dateMouse.containsMouse
Behavior on opacity { NumberAnimation {} } Behavior on opacity { NumberAnimation {} }
color: theme.viewBackgroundColor color: theme.viewBackgroundColor
z: todayRect.z - 1
//border.color: isToday(dayNumber+"/"+monthNumber+"/"+yearNumber) ? theme.highlightColor : "transparent" //border.color: isToday(dayNumber+"/"+monthNumber+"/"+yearNumber) ? theme.highlightColor : "transparent"
} }

View File

@ -47,8 +47,6 @@ Item {
property int implicitWidth: theme.mSize(theme.defaultFont).width * 6 * 8 property int implicitWidth: theme.mSize(theme.defaultFont).width * 6 * 8
property int implicitHeight: theme.mSize(theme.defaultFont).height * 2 * 9 property int implicitHeight: theme.mSize(theme.defaultFont).height * 2 * 9
//property int cellFontPixelSize: theme.defaultFont.pixelSize
property Item selectedItem property Item selectedItem
property int week; property int week;
property int firstDay: new Date(showDate.getFullYear(), showDate.getMonth(), 1).getDay() property int firstDay: new Date(showDate.getFullYear(), showDate.getMonth(), 1).getDay()
@ -77,7 +75,6 @@ Item {
function isToday(date) { function isToday(date) {
if (date == Qt.formatDateTime(new Date(), "d/M/yyyy")) { if (date == Qt.formatDateTime(new Date(), "d/M/yyyy")) {
print("!!!!!!!!!!!!!! TODAY: " + date);
return true; return true;
} }
else return false; else return false;
@ -136,7 +133,8 @@ Item {
days: 7 days: 7
weeks: 6 weeks: 6
startDay: 1 startDay: 1
startDate: "2013-08-01" //startDate: "2013-08-01"
startDate: isTodayMonth();
onStartDateChanged: { onStartDateChanged: {
//monthHeading.text = monthName //monthHeading.text = monthName
//monthHeading.text = monthName //monthHeading.text = monthName
@ -169,6 +167,7 @@ Item {
Item { Item {
id: calendarToolbar id: calendarToolbar
visible: false
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
@ -214,5 +213,4 @@ Item {
} }
} }
} }
} }