WeekNumberColumn QML Type

  • Import Statement: import Qt.labs.calendar 1.0

  • Inherits: FocusScope

Detailed Description

WeekNumberColumn presents week numbers in a column. The week numbers are calculated for a given month and year, using the specified locale.

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

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

Image non disponible
 
Sélectionnez
RowLayout {
    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.fillHeight: true
    }
}

The visual appearance of WeekNumberColumn 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 week number.

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

model.weekNumber : int

The week number

The following snippet presents the default implementation of the item delegate. It can be used as a starting point for implementing custom delegates.

 
Sélectionnez
delegate: Text {
    text: model.weekNumber
    font: control.font
    horizontalAlignment: Text.AlignHCenter
    verticalAlignment: Text.AlignVCenter
}

month : int

This property holds the number of the month that the week numbers are calculated for. The default value is the current month.

The Qt Labs Calendar module uses 0-based month numbers to be consistent with the JavaScript Date type, that is used by the QML language. This means that Date::getMonth() can be assigned to this property as is. When dealing with dealing with month numbers directly, it is highly recommended to use the following enumeration values to avoid confusion.

Constant

Description

Cal