Document calendar setting of QCalendarWidget and QDateTimeEdit

It seems this was neglected in 5.14, when the methods were added.
The calendar setting is also not a Q_PROPERTY; and hadn't been tested
until recently.

This follows up on commit 2dee00621632ab8acd0b3d59bdba264afe2f32c1

Pick-to: 6.5
Task-number: QTBUG-115200
Change-Id: I9625bf54d05a55a40867847bd58130be90e78271
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 33cc65328819836374eb4823e571789b066003f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-04-12 10:11:52 +02:00 committed by Qt Cherry-pick Bot
parent e8b3e37c5a
commit bbdf2b86f5
2 changed files with 33 additions and 0 deletions

View File

@ -2731,12 +2731,29 @@ bool QCalendarWidget::isGridVisible() const
return d->m_view->showGrid();
}
/*!
\since 5.14
Report the calendar system in use by this widget.
\sa setCalendar()
*/
QCalendar QCalendarWidget::calendar() const
{
Q_D(const QCalendarWidget);
return d->m_model->m_calendar;
}
/*!
\since 5.14
Set \a c as the calendar system to be used by this widget.
The widget can use any supported calendar system.
By default, it uses the Gregorian calendar.
\sa calendar()
*/
void QCalendarWidget::setCalendar(QCalendar c)
{
Q_D(QCalendarWidget);

View File

@ -303,6 +303,12 @@ void QDateTimeEdit::setTime(QTime time)
}
}
/*!
\since 5.14
Report the calendar system in use by this widget.
\sa setCalendar()
*/
QCalendar QDateTimeEdit::calendar() const
{
@ -310,6 +316,16 @@ QCalendar QDateTimeEdit::calendar() const
return d->calendar;
}
/*!
\since 5.14
Set \a calendar as the calendar system to be used by this widget.
The widget can use any supported calendar system.
By default, it uses the Gregorian calendar.
\sa calendar()
*/
void QDateTimeEdit::setCalendar(QCalendar calendar)
{
Q_D(QDateTimeEdit);