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을 기준으로 한 월 번호를 사용합니다. 하지만 이는 월 번호가 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.