CalendarModel QML Type
カレンダーモデル。詳細...
| Import Statement: | import QtQuick.Controls |
プロパティ
方法
- int indexOf(Date date)
- int indexOf(int year, int month)
- int monthAt(int index)
- int yearAt(int index)
詳細な説明
CalendarModel は、一連の `MonthGrid ` インスタンスを作成する手段を提供します。これは通常、MonthGrid をデリゲートとして使用する `ListView ` のモデルとして使用されます。
ListView {
id: listview
width: 200; height: 200
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
model: CalendarModel {
from: new Date(2015, 0, 1)
to: new Date(2015, 11, 31)
}
delegate: MonthGrid {
width: listview.width
height: listview.height
month: model.month
year: model.year
locale: Qt.locale("en_US")
}
ScrollIndicator.horizontal: ScrollIndicator { }
}index プロパティに加え、各デリゲートのコンテキストでは、以下のモデルデータロールが利用可能です:
| model.month: int | 月の番号 |
| model.year: int | 年の番号 |
Qt Quick コントロールのカレンダー関連型では、JavaScript の Date オブジェクトと同様に、0 から始まる月番号が使用されます。ただし、これは月番号が 1 から始まるQDate とは異なります。
混乱を避けるために、以下の列挙値を使用できます:
| 定数 | 説明 |
|---|---|
Calendar.January | 1月 (0) |
Calendar.February | 2月 (1) |
Calendar.March | 3月 (2) |
Calendar.April | 4月 (3) |
Calendar.May | 5月 (4) |
Calendar.June | 6月 (5) |
Calendar.July | 7月 (6) |
Calendar.August | 8月 (7) |
Calendar.September | 9月 (8) |
Calendar.October | 10月 (9) |
Calendar.November | 11月 (10) |
Calendar.December | 12月 (11) |
MonthGrid およびCalendarもご参照ください 。
プロパティのドキュメント
from : date
このプロパティには開始日が格納されます。
to : date
このプロパティには終了日が格納されます。
メソッドのドキュメント
int indexOf(Date date)
指定されたdate のモデルインデックスを返します。
int indexOf(int year, int month)
指定されたyear およびmonth のモデルインデックスを返します。
int monthAt(int index)
指定されたモデル `index` の月番号を返します。
int yearAt(int index)
指定されたモデル `index` の年数を返します。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.