このページでは

WeekNumberColumn QML Type

週番号の列。詳細...

Import Statement: import QtQuick.Controls
Inherits:

Control

プロパティ

詳細な説明

WeekNumberColumnは、列形式で週番号を表示します。週番号は、指定されたmonth およびyear に基づき、指定されたlocale を用いて計算されます。

週番号を表示する「週番号」列

WeekNumberColumn {
    month: Calendar.December
    year: 2015
    locale: Qt.locale("en_US")
}

WeekNumberColumnは単独のコントロールとして使用することもできますが、MonthGrid と組み合わせて使用されることが最も一般的です。使用方法にかかわらず、列の位置指定はユーザーに委ねられます。

カレンダーレイアウトの「週番号」列

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

custom delegate を実装することで、WeekNumberColumnの外観を変更できます。

「 MonthGrid 」および「DayOfWeekRow 」も参照してください 。

プロパティのドキュメント

delegate : Component

このプロパティには、各週番号を可視化するアイテムデリゲートが格納されます。

index プロパティに加え、各デリゲートのコンテキストでは、モデルデータのロールの一覧が利用可能です:

model.weekNumber: int週番号

以下のスニペットは、アイテムデリゲートのデフォルトの実装を示しています。これは、カスタムデリゲートを実装する際の出発点として使用できます。

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

    required property int weekNumber
}

WeekNumberColumn デリゲートの所有権を取得しません。

month : int

このプロパティには、週番号の計算対象となる月の番号が格納されます。デフォルト値は現在の月です。

Qt Quick コントロール内のカレンダー関連の型は、JavaScriptのDateオブジェクトと同様に、0を起点とする月番号を使用します。ただし、これはQDate とは異なり、 では月の番号は1から始まります。

混乱を避けるために、以下の列挙値を使用できます。

定数説明
Calendar.January1月 (0)
Calendar.February2月 (1)
Calendar.March3月 (2)
Calendar.April4月 (3)
Calendar.May5月 (4)
Calendar.June6月 (5)
Calendar.July7月 (6)
Calendar.August8月 (7)
Calendar.September9月 (8)
Calendar.October10月 (9)
Calendar.November11月 (10)
Calendar.December12月 (11)

Calendarも参照してください 。

year : int

このプロパティには、週番号の計算対象となる年の番号が格納されます。

値は、-271820 から275759 の範囲内でなければなりません。デフォルト値は今年度です。

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