WeekNumberColumn QML Type

A column of week numbers. More...

Import Statement: import Qt.labs.calendar 1.0
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.

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

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

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.