MonthGrid QML Type

  • Import Statement: import Qt.labs.calendar 1.0

  • Inherits: FocusScope

Detailed Description

MonthGrid presents a calendar month in a grid. The contents are calculated for a given month and year, using the specified locale.

Image non disponible
 
Sélectionnez
MonthGrid {
    month: Calendar.December
    year: 2015
    locale: Qt.locale("en_US")
}

MonthGrid can be used as a standalone control, but it is most often used in conjunction with DayOfWeekRow and WeekNumberColumn. Regardless of the use case, positioning of the grid is left to the user.

Image non disponible
 
Sélectionnez
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
    }
}

The visual appearance of MonthGrid can be changed by implementing a custom delegate.

Types in Qt.labs modules are not guaranteed to remain compatible in future versions.

See Also

Property Documentation

 

delegate : Component

This property holds the item delegate that visualizes each day.

In addition to the index property, a list of model data roles are available in the context of each delegate:

model.date : date

The date of the cell

model.day : int

The number of the day

model.today : bool

Whether the delegate represents today

model.weekNumber : int

The week number

model.month : int

The number of the month

model.year : int

The number of the year

The following snippet presents the default implementation o