目前显示日历还没有QtQuick.Controls2, 只能用1显示
Calendar {
anchors.centerIn: parent
style: CalendarStyle {
gridVisible: false
dayDelegate: Rectangle {
property bool dayIsValid: dayValid(styleData.date.getDate().toString())
gradient: Gradient {
GradientStop {
position: 0.00
color: styleData.selected && dayIsValid ? "#148014" : (styleData.visibleMonth && styleData.valid ? (dayIsValid ? "#CCCCCC" : "#FFFFFF") : "#FFFFFF");
}
}
Label {
text: styleData.date.getDate()
anchors.centerIn: parent
}
Rectangle {
width: parent.width
height: 1
color: "#EEEEEE"
anchors.bottom: parent.bottom
}
Rectangle {
width: 1
height: parent.height
color: "#EEEEEE"
anchors.right: parent.right
}
}
}
}
需要完整代码请访问QtQuickExamples