- Qt 6.7
- Qt Quick Controls
- QML Types
- WeekNumberColumn
- Qt 6.7.0 Reference Documentation

# WeekNumberColumn QML Type

A column of week numbers. More...

Import Statement: | import QtQuick.Controls
Inherits: | Control

- List of all members, including inherited members

## Properties

- delegate : Component
- month : int
- year : int

## Detailed Description

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

     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.

     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.

See also MonthGrid and DayOfWeekRow.

## 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.

     delegate: Text {
         text: weekNumber
         font: control.font
         horizontalAlignment: Text.AlignHCenter
         verticalAlignment: Text.AlignVCenter

         required property int weekNumber
     }

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 Quick 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 passed to the methods as is. When dealing with month numbers directly, it is highly recommended to use the following enumeration values to avoid confusion.

Constant | Description
--- | ---
`Calendar.January` | January (0)
`Calendar.February` | February (1)
`Calendar.March` | March (2)
`Calendar.April` | April (3)
`Calendar.May` | May (4)
`Calendar.June` | June (5)
`Calendar.July` | July (6)
`Calendar.August` | August (7)
`Calendar.September` | September (8)
`Calendar.October` | October (9)
`Calendar.November` | November (10)
`Calendar.December` | December (11)

See also Calendar.

year : int

This property holds the number of the year that the week numbers are calculated for.

The value must be in the range from `-271820` to `275759`. The default value is the current year.