DayOfWeekRow QML Type
一周中各天的名称列表。更多...
| Import Statement: | import QtQuick.Controls |
| Inherits: |
属性
- delegate : Component
详细说明
DayOfWeekRow 控件将星期名称以一行形式呈现。星期名称的排序和格式化均依据指定的locale 进行。

DayOfWeekRow {
locale: Qt.locale("en_US")
}DayOfWeekRow 可以作为独立控件使用,但通常与MonthGrid 配合使用。无论在何种使用场景下,该行的位置均由用户自行决定。

ColumnLayout {
DayOfWeekRow {
locale: grid.locale
Layout.fillWidth: true
}
MonthGrid {
id: grid
month: Calendar.December
year: 2015
locale: Qt.locale("en_US")
Layout.fillWidth: true
}
}通过实现custom delegate ,可以更改DayOfWeekRow的外观。
另请参阅 MonthGrid 和WeekNumberColumn 。
属性文档
delegate : Component
该属性存储用于可视化每周每一天的项目委托。
除了index 属性外,每个委托的上下文中还提供了一系列模型数据角色:
| model.day: int | 星期几(Qt::DayOfWeek ) |
| model.longName: string | 星期名称的完整形式;例如,“Monday”(QLocale::LongFormat ) |
| model.shortName: string | 星期名称的简写形式;例如,“Mon” (QLocale::ShortFormat) |
| model.narrowName: 字符串 | 一种用于空间受限情况下的特殊星期名称。例如,“M”(QLocale::NarrowFormat ) |
以下代码片段展示了项目委托的默认实现。它可作为实现自定义委托的起点。
delegate: Text {
text: shortName
font: control.font
color: control.palette.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
required property string shortName
}DayOfWeekRow 不会获取委托的所有权。
© 2026 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.