我嘗試像 doc 一樣使用日歷。
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Calendar{
minimumDate: new Date(2017, 0, 1)
maximumDate: new Date(2018, 0, 1)
}
}
但是我收到了這個錯誤:無法創建復合單例型別日歷。有誰知道如何使用它?
uj5u.com熱心網友回復:
您可能Calendar將 Qt5 中的(小部件)與CalendarQt 6 中的(命名空間)混淆了。
在 Qt 6 中有點不同,你必須自己創建這個控制元件,例如:
ColumnLayout {
DayOfWeekRow {
locale: grid.locale
Layout.fillWidth: true
}
MonthGrid {
id: grid
month: Calendar.December // this is how the Calendar can be used
year: 2022
locale: Qt.locale("en_US")
Layout.fillWidth: true
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/487708.html
上一篇:插槽中的多個引數
