Calendar QML Type
import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick.Controls 2.5 import QtQuick.Controls 1.4 as Con1_4 Window { id:window width: 640 height: 480 visible: true title: qsTr("Hello World") Item{ id:root anchors.fill: parent Con1_4.Calendar { minimumDate: new Date(2017, 0, 1) maximumDate: new Date() onSelectedDateChanged: { let strData = Qt.formatDateTime(selectedDate, "yyyy-MM-dd hh:mm:ss") console.log("选择的时间为: " + strData) } } } }
- 输出: