WeekNumberColumn QML Type

A column of week numbers. 更多...

import 语句: import QtQuick.Controls
继承:

Control

特性

详细描述

WeekNumberColumn presents week numbers in a column. The week numbers are calculated for a given month and year ,使用指定 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 .

另请参阅 MonthGrid and DayOfWeekRow .

特性文档编制

delegate : Component

This property holds the item delegate that visualizes each week number.

除了 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.

常量 描述
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)

另请参阅 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.