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 Controlsのカレンダー関連の型は、JavaScriptのDateオブジェクトのように、0ベースの月番号を使用します。しかし、これはQDate とは異なり、月番号は1から始まります。
混乱を避けるために、以下の列挙値を使用することができます:
| 定数 | 説明 |
|---|---|
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.