WeekNumberColumn QML Type

A column of week numbers. More...

Import Statement: import QtQuick.Controls
Inherits:

Control

Properties

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 : intThe 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
}

WeekNumberColumn does not take ownership of the delegate.


month : int

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

Calendar-related types in Qt Quick Controls use 0-based month numbers, like the JavaScript Date objects. However, this differs from QDate, where the months are numbered starting from 1.

To avoid confusion, you can use the following enumeration values:

ConstantDescription
Calendar.JanuaryJanuary (0)
Calendar.FebruaryFebruary (1)
Calendar.MarchMarch (2)
Calendar.AprilApril (3)
Calendar.MayMay (4)
Calendar.JuneJune (5)
Calendar.JulyJuly (6)
Calendar.AugustAugust (7)
Calendar.SeptemberSeptember (8)
Calendar.OctoberOctober (9)
Calendar.NovemberNovember (10)
Calendar.DecemberDecember (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.


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