MonthGrid QML Type

한 달의 날짜 그리드입니다. 더 보기...

Import Statement: import QtQuick.Controls
Inherits:

Control

속성

신호

상세 설명

MonthGrid는 달력 월을 그리드로 표시합니다. 콘텐츠는 지정된 monthyear, 지정된 locale 을 사용하여 계산됩니다.

MonthGrid {
    month: Calendar.December
    year: 2015
    locale: Qt.locale("en_US")
}

MonthGrid는 독립형 컨트롤로 사용할 수 있지만 DayOfWeekRowWeekNumberColumn 과 함께 사용하는 경우가 가장 많습니다. 사용 사례에 관계없이 그리드의 위치는 사용자에게 맡겨집니다.

GridLayout {
    columns: 2

    DayOfWeekRow {
        locale: grid.locale

        Layout.column: 1
        Layout.fillWidth: true
    }

    WeekNumberColumn {
        month: grid.month
        year: grid.year
        locale: grid.locale

        Layout.fillHeight: true
    }

    MonthGrid {
        id: grid
        month: Calendar.December
        year: 2015
        locale: Qt.locale("en_US")

        Layout.fillWidth: true
        Layout.fillHeight: true
    }
}

MonthGrid의 시각적 모양은 custom delegate 을 구현하여 변경할 수 있습니다.

특정 월을 볼 때 MonthGrid는 이전 달과 다음 달의 날짜를 표시합니다. 즉, 첫 번째 행이나 마지막 행이 완전히 인접한 달 안에 있는 경우에도 항상 6개의 행이 표시됩니다.

날짜 지역화하기

날짜를 지역화하려면 Locale.toString()를 사용합니다. 예를 들어 아랍어 로캘에서 요일 번호를 표시하려면 다음과 같이 하세요:

MonthGrid {
    id: monthGrid
    month: Calendar.December
    year: 2015
    locale: Qt.locale("ar")
    delegate: Text {
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        opacity: model.month === monthGrid.month ? 1 : 0
        text: monthGrid.locale.toString(model.date, "d")
        font: monthGrid.font

        required property var model
    }
}

DayOfWeekRow, WeekNumberColumn, CalendarModel참조하세요 .

속성 문서

delegate : Component

이 속성에는 각 요일을 시각화하는 항목 델리게이트가 있습니다.

index 속성 외에도 각 델리게이트의 컨텍스트에서 모델 데이터 역할 목록을 사용할 수 있습니다:

model.date: 날짜셀의 날짜
model.day: int요일 번호
model.today: bool델리게이트가 오늘을 나타내는지 여부
model.weekNumber: int주 번호
model.month: int월 번호
model.year: int연도 번호

다음 스니펫은 항목 델리게이트의 기본 구현을 보여줍니다. 사용자 지정 델리게이트를 구현하기 위한 시작점으로 사용할 수 있습니다.

delegate: Text {
    horizontalAlignment: Text.AlignHCenter
    verticalAlignment: Text.AlignVCenter
    opacity: model.month === control.month ? 1 : 0
    text: model.day
    font: control.font

    required property var model
}

month : int

이 속성은 월의 숫자를 보유합니다. 기본값은 현재 월입니다.

Qt Quick 캘린더 모듈은 0을 기준으로 한 월 번호를 사용하여 QML 언어에서 사용하는 JavaScript 날짜 유형과 일관성을 유지합니다. 즉, Date::getMonth() 을 그대로 메서드에 전달할 수 있습니다. 월 번호를 직접 처리할 때는 혼동을 피하기 위해 다음 열거형 값을 사용하는 것이 좋습니다.

상수설명
Calendar.JanuaryJanuary (0)
Calendar.FebruaryFebruary (1)
Calendar.MarchMarch (2)
Calendar.April4월 (3)
Calendar.May5월 (4)
Calendar.June6월 (5)
Calendar.July7월 (6)
Calendar.August8월 (7)
Calendar.September9월 (8)
Calendar.October10월 (9)
Calendar.November11월 (10)
Calendar.December12월 (11)

Calendar도 참조하세요 .


title : string

이 속성은 달력에 대한 제목을 보유합니다.

이 속성은 편의를 위해 제공되며 MonthGrid 자체는 제목을 시각화하지 않습니다. 기본값은 locale 를 사용하여 서식이 지정된 월 이름과 연도 번호로 구성됩니다.


year : int

이 속성은 연도 번호를 보유합니다.

값은 -271820 ~ 275759 범위여야 합니다. 기본값은 현재 연도입니다.


신호 문서

clicked(date date)

date 을 클릭하면 이 신호가 발생합니다.

참고: 해당 핸들러는 onClicked 입니다.


pressAndHold(date date)

date 을 길게 누르면 이 신호가 전송됩니다.

참고: 해당 핸들러는 onPressAndHold 입니다.


pressed(date date)

date 을 누르면 이 신호가 발생합니다.

참고: 해당 핸들러는 onPressed 입니다.


released(date date)

date 을 놓으면 이 신호가 전송됩니다.

참고: 해당 핸들러는 onReleased 입니다.


© 2025 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.