14#include <private/qwidget_p.h>
21#include <private/qapplication_p.h>
74 return "<b>"_L1 +
str +
"</b>"_L1;
139 m_day = m_day % 10 * 10 + pressedKey;
152 auto parts = cal.partsFromDate(
date);
153 if (!parts.isValid())
155 parts.day =
qMin(
qMax(1, m_day), cal.daysInMonth(parts.month, parts.year));
156 return cal.dateFromParts(parts);
161 m_day = m_oldDay =
date.
day(cal);
174 }
else if (repeat == 2) {
176 }
else if (repeat == 3) {
229 m_month = m_oldMonth;
231 m_month = m_month / 10;
242 m_month = pressedKey;
244 m_month = m_month % 10 * 10 + pressedKey;
257 auto parts = cal.partsFromDate(
date);
258 if (!parts.isValid())
260 parts.month =
qMin(
qMax(1, m_month), cal.monthsInYear(parts.year));
261 parts.day =
qMin(parts.day, cal.daysInMonth(m_month, parts.year));
262 return cal.dateFromParts(parts);
278 const auto parts = cal.partsFromDate(
date);
317int QCalendarYearValidator::pow10(
int n)
320 for (
int i = 0;
i <
n;
i++)
343 int pow = pow10(m_pos);
344 m_year = m_oldYear / pow * pow + m_year % (pow * 10) / 10;
353 int pow = pow10(m_pos);
354 m_year = m_year / (pow * 10) * (pow * 10) + m_year % pow * 10 + pressedKey;
365 auto parts = cal.partsFromDate(
date);
366 if (!parts.isValid())
369 parts.year =
qMax(1, m_year);
370 parts.day =
qMin(parts.day, cal.daysInMonth(parts.month, parts.year));
371 return cal.dateFromParts(parts);
376 m_year = m_oldYear =
date.
year(cal);
423 void toPreviousToken();
430 std::vector<SectionToken> m_tokens;
444 : m_currentToken(-1),
445 m_initialDate(
QDate::currentDate()),
446 m_currentDate(m_initialDate),
464int QCalendarDateValidator::countRepeat(
const QString &
str,
int index)
const
479 m_initialDate =
date;
480 m_currentDate =
date;
487 const int numSeps = m_separators.size();
488 const int numTokens = int(m_tokens.size());
489 for (
int i = 0;
i < numSeps; ++
i) {
490 str += m_separators.at(
i);
493 if (
i == m_currentToken)
496 str +=
token.validator->text(m_currentDate, cal,
token.repeat);
502void QCalendarDateValidator::clear()
505 m_separators.clear();
515 const auto quote = u
'\'';
516 bool quoting =
false;
527 separator += nextChar;
531 if (nextChar == u
'd') {
533 validator = &m_dayValidator;
534 }
else if (nextChar == u
'M') {
536 validator = &m_monthValidator;
537 }
else if (nextChar == u
'y') {
539 validator = &m_yearValidator;
541 separator += nextChar;
545 m_separators.append(separator);
547 if (m_currentToken < 0)
548 m_currentToken = int(m_tokens.size()) - 1;
555 m_separators += separator;
558void QCalendarDateValidator::applyToDate(
QCalendar cal)
560 m_currentDate = m_yearValidator.
applyToDate(m_currentDate, cal);
561 m_currentDate = m_monthValidator.
applyToDate(m_currentDate, cal);
562 m_currentDate = m_dayValidator.
applyToDate(m_currentDate, cal);
565void QCalendarDateValidator::toNextToken()
567 if (m_currentToken < 0)
570 m_currentToken %= m_tokens.size();
573void QCalendarDateValidator::toPreviousToken()
575 if (m_currentToken < 0)
578 m_currentToken %= m_tokens.size();
583 if (m_currentToken < 0)
586 int key = keyEvent->
key();
596 m_lastSectionMove = m_tokens[m_currentToken].validator->handleKey(
key);
613 m_widget(
nullptr), m_editDelay(1500), m_date(
QDate::currentDate()) {}
632 void updateDateLabel();
633 void createDateLabel();
634 void removeDateLabel();
662void QCalendarTextNavigator::updateDateLabel()
667 m_acceptTimer.
start(m_editDelay,
this);
673 QRect newRect((
r.width() -
s.width()) / 2, (
r.height() -
s.height()) / 2,
s.width(),
s.height());
681 m_dateFrame->
raise();
685void QCalendarTextNavigator::applyDate()
695void QCalendarTextNavigator::createDateLabel()
699 m_dateFrame =
new QFrame(m_widget);
702 vl->addWidget(m_dateText);
715void QCalendarTextNavigator::removeDateLabel()
719 m_acceptTimer.
stop();
722 delete m_dateValidator;
723 m_dateFrame =
nullptr;
724 m_dateText =
nullptr;
725 m_dateValidator =
nullptr;
733 if ((ke->text().size() > 0 && ke->text().at(0).isPrint()) || m_dateFrame) {
738#if QT_CONFIG(shortcut)
797 static constexpr int day2idx(
Qt::DayOfWeek day)
noexcept {
return int(day) - 1; }
800 : contained{},
data{}
808 const int idx = day2idx(day);
809 contained[idx] =
true;
815 operator[](day).swap(
v);
920#if QT_CONFIG(wheelevent)
921 void wheelEvent(QWheelEvent *
event)
override;
930 bool validDateClicked;
931#ifdef QT_KEYPAD_NAVIGATION
940 m_date(
QDate::currentDate()),
941 m_minimumDate(
QDate::fromJulianDay(1)),
942 m_maximumDate(9999, 12, 31),
943 m_shownYear(m_date.year(m_calendar)),
944 m_shownMonth(m_date.month(m_calendar)),
945 m_firstDay(
QLocale().firstDayOfWeek()),
947 m_weekNumbersShown(true),
955 if (col < 0 || col > 6)
965 if (day < 1 ||
unsigned(day) >
unsigned(7))
989 while (refDay <= 31) {
991 if (refDate.isValid())
1010 if (!refDate.isValid())
1017 const int requestedDay =
1019 return refDate.addDays(requestedDay);
1033 if (!refDate.isValid())
1038 columnForFirstOfShownMonth + refDate.day(
m_calendar) - 1);
1040 int c = requestedPosition % 7;
1041 int r = requestedPosition / 7;
1065 return standaloneDayName.
left(1);
1066 return standaloneDayName;
1086 if (!
m_view->isEnabled())
1088 else if (!
m_view->isActiveWindow())
1144 return fmt.background().color();
1146 return fmt.foreground().color();
1150 return fmt.toolTip();
1307 validDateClicked(
false)
1323 QCalendar cal = calendarModel->calendar();
1330 switch (cursorAction) {
1332 currentDate = currentDate.
addDays(-7);
1335 currentDate = currentDate.
addDays(7);
1344 auto parts = cal.partsFromDate(currentDate);
1345 if (parts.isValid()) {
1347 currentDate = cal.dateFromParts(parts);
1352 auto parts = cal.partsFromDate(currentDate);
1353 if (parts.isValid()) {
1354 parts.
day = cal.daysInMonth(parts.month, parts.year);
1355 currentDate = cal.dateFromParts(parts);
1360 currentDate = currentDate.
addMonths(-1, cal);
1363 currentDate = currentDate.
addMonths(1, cal);
1377#ifdef QT_KEYPAD_NAVIGATION
1379 if (QApplicationPrivate::keypadNavigationEnabled()) {
1380 if (!hasEditFocus()) {
1386 if (QApplicationPrivate::keypadNavigationEnabled() && hasEditFocus()) {
1387 if (qobject_cast<QCalendarModel *>(
model())) {
1389 setEditFocus(
false);
1397 switch (
event->key()) {
1410#if QT_CONFIG(wheelevent)
1411void QCalendarView::wheelEvent(QWheelEvent *
event)
1413 const int numDegrees =
event->angleDelta().y() / 8;
1414 const int numSteps = numDegrees / 15;
1417 QDate currentDate = calendarModel->dateForCell(
index.row(),
index.column());
1418 currentDate = currentDate.
addMonths(-numSteps, calendarModel->calendar());
1425#ifdef QT_KEYPAD_NAVIGATION
1428 origDate = calendarModel->m_date;
1442 QPoint pos =
event->position().toPoint();
1446 && date <= calendarModel->m_maximumDate) {
1455 if (!calendarModel) {
1464 validDateClicked =
false;
1473 if (!calendarModel) {
1486 validDateClicked =
true;
1487 int row = -1, col = -1;
1489 if (
row != -1 && col != -1) {
1493 validDateClicked =
false;
1501 if (!calendarModel) {
1509 if (validDateClicked) {
1512 int row = -1, col = -1;
1514 if (
row != -1 && col != -1) {
1526 if (!calendarModel) {
1537 if (validDateClicked) {
1545 validDateClicked =
false;
1564 mutable QStyleOptionViewItem storedOption;
1692 storedOption.rect =
rect;
1718 if (
enable == navigatorEnabled)
1786 headerLayout->setSpacing(0);
1788 headerLayout->insertStretch(headerLayout->count());
1792 headerLayout->insertStretch(headerLayout->count());
1823 int beg = 1,
end = maxMonths;
1824 bool prevEnabled =
true;
1825 bool nextEnabled =
true;
1830 prevEnabled =
false;
1835 nextEnabled =
false;
1839 for (
int i = 1;
i <= maxMonths;
i++) {
1840 bool monthEnabled =
true;
1841 if (i < beg || i >
end)
1842 monthEnabled =
false;
1851 for (
int i = 1;
i <= 12;
i++) {
1863 QDate minDate =
q->minimumDate();
1864 QDate maxDate =
q->maximumDate();
1865 if (minDate.isValid()&& minDate.daysTo(newDate) < 0)
1867 if (maxDate.isValid()&& maxDate.daysTo(newDate) > 0)
1869 showMonth(newDate.year(cal), newDate.month(cal));
1870 int row = -1, col = -1;
1872 if (
row != -1 && col != -1)
1910 qApp->removeEventFilter(
q);
1931 qApp->installEventFilter(
q);
1944 emit q->currentPageChanged(year, month);
1998 if (oldDate != newDate) {
2002 emit q->selectionChanged();
2108 setAutoFillBackground(
true);
2112 layoutV->setContentsMargins(
QMargins());
2119 d->m_view->setObjectName(
"qt_calendar_calendarview"_L1);
2120 d->m_view->setModel(
d->m_model);
2121 d->m_model->setView(
d->m_view);
2125 d->m_view->horizontalHeader()->setSectionsClickable(
false);
2127 d->m_view->verticalHeader()->setSectionsClickable(
false);
2128 d->m_selection =
d->m_view->selectionModel();
2129 d->createNavigationBar(
this);
2132 d->m_view->setItemDelegate(
d->m_delegate);
2134 d->updateNavigationBar();
2136 setFocusProxy(
d->m_view);
2142 this,
SLOT(_q_slotChangeDate(
QDate,
bool)));
2146 this,
SLOT(_q_editingFinished()));
2149 this,
SLOT(_q_prevMonthClicked()));
2151 this,
SLOT(_q_nextMonthClicked()));
2153 this,
SLOT(_q_yearClicked()));
2157 this,
SLOT(_q_yearEditingFinished()));
2159 layoutV->setContentsMargins(
QMargins());
2160 layoutV->setSpacing(0);
2161 layoutV->addWidget(
d->navBarBackground);
2162 layoutV->addWidget(
d->m_view);
2165 setDateEditEnabled(
true);
2189 if (
d->cachedSizeHint.isValid())
2190 return d->cachedSizeHint;
2208 for (
int i = 1;
i <= 7;
i++) {
2210 w =
qMax(
w, fm.horizontalAdvance(
d->m_model->dayName(
d->m_model->dayOfWeekForColumn(
i))) + marginH);
2211 h =
qMax(
h, fm.height());
2218 for (
int i = 1;
i <= 6;
i++) {
2220 for (
int j = 1;
j <
end;
j++)
2222 h =
qMax(
h, fm.height());
2227 for (
int i = 1;
i <=
end;
i++) {
2229 h =
qMax(
h, fm.height());
2232 if (
d->m_view->showGrid()) {
2240 h =
qMax(
h,
d->m_view->verticalHeader()->minimumSectionSize());
2241 w =
qMax(
w,
d->m_view->horizontalHeader()->minimumSectionSize());
2245 if (
d->navBarVisible) {
2246 int headerH =
d->navBarBackground->sizeHint().height();
2249 headerW +=
d->prevMonth->sizeHint().width();
2250 headerW +=
d->nextMonth->sizeHint().width();
2254 for (
int i = 1;
i < 12;
i++) {
2256 monthW =
qMax(monthW, fm.boundingRect(monthName).width());
2258 const int buttonDecoMargin =
d->monthButton->sizeHint().width() - fm.boundingRect(
d->monthButton->text()).width();
2259 headerW += monthW + buttonDecoMargin;
2261 fm =
d->yearButton->fontMetrics();
2262 headerW += fm.boundingRect(
"5555"_L1).width() + buttonDecoMargin;
2270 w += cm.left() + cm.right();
2271 h += cm.top() + cm.bottom();
2273 return d->cachedSizeHint;
2300 return d->m_model->m_date;
2306 if (
d->m_model->m_date ==
date &&
date ==
d->getCurrentDate())
2312 d->m_model->setDate(
date);
2314 QDate newDate =
d->m_model->m_date;
2316 d->showMonth(newDate.year(cal), newDate.month(cal));
2330 return d->m_model->m_shownYear;
2343 return d->m_model->m_shownMonth;
2361 QDate currentDate =
d->getCurrentDate();
2363 int day = currentDate.
day(cal);
2364 int daysInMonths = cal.daysInMonth(month, year);
2365 if (day > daysInMonths)
2368 d->showMonth(year, month);
2370 QDate newDate(year, month, day,
d->m_model->m_calendar);
2371 int row = -1, col = -1;
2372 d->m_model->cellForDate(newDate, &
row, &col);
2373 if (
row != -1 && col != -1) {
2374 d->m_view->selectionModel()->setCurrentIndex(
d->m_model->index(
row, col),
2391 if (month ==
d->m_model->m_calendar.maximumMonthsInYear()) {
2415 month =
d->m_model->m_calendar.maximumMonthsInYear();
2509 return d->m_model->m_minimumDate;
2518 QDate oldDate =
d->m_model->m_date;
2519 d->m_model->setMinimumDate(
date);
2520 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year(
d->m_model->m_calendar));
2521 d->updateMonthMenu();
2522 QDate newDate =
d->m_model->m_date;
2523 if (oldDate != newDate) {
2525 d->showMonth(newDate.year(
d->m_model->m_calendar), newDate.month(
d->m_model->m_calendar));
2565 return d->m_model->m_maximumDate;
2574 QDate oldDate =
d->m_model->m_date;
2575 d->m_model->setMaximumDate(
date);
2576 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year(
d->m_model->m_calendar));
2577 d->updateMonthMenu();
2578 QDate newDate =
d->m_model->m_date;
2579 if (oldDate != newDate) {
2581 d->showMonth(newDate.year(
d->m_model->m_calendar), newDate.month(
d->m_model->m_calendar));
2614 if (
d->m_model->m_minimumDate == min &&
d->m_model->m_maximumDate == max)
2616 if (!min.isValid() || !max.
isValid())
2619 QDate oldDate =
d->m_model->m_date;
2620 d->m_model->setRange(min, max);
2621 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year(
d->m_model->m_calendar));
2622 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year(
d->m_model->m_calendar));
2623 d->updateMonthMenu();
2624 QDate newDate =
d->m_model->m_date;
2625 if (oldDate != newDate) {
2627 d->showMonth(newDate.year(
d->m_model->m_calendar), newDate.month(
d->m_model->m_calendar));
2656 if (
d->m_model->m_horizontalHeaderFormat ==
format)
2659 d->m_model->setHorizontalHeaderFormat(
format);
2660 d->cachedSizeHint =
QSize();
2661 d->m_view->viewport()->update();
2662 d->m_view->updateGeometry();
2668 return d->m_model->m_horizontalHeaderFormat;
2693 bool shown =
d->m_model->weekNumbersShown();
2705 if (
d->m_model->weekNumbersShown() ==
show)
2707 d->m_model->setWeekNumbersShown(
show);
2708 d->cachedSizeHint =
QSize();
2709 d->m_view->viewport()->update();
2710 d->m_view->updateGeometry();
2731 return d->m_view->showGrid();
2744 return d->m_model->m_calendar;
2760 d->m_model->setCalendar(
c);
2761 d->updateMonthMenuNames();
2762 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year(
d->m_model->m_calendar));
2763 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year(
d->m_model->m_calendar));
2764 d->updateNavigationBar();
2770 d->m_view->setShowGrid(
show);
2771 d->cachedSizeHint =
QSize();
2772 d->m_view->viewport()->update();
2773 d->m_view->updateGeometry();
2820 d->m_model->setFirstColumnDay(dayOfWeek);
2836 return d->m_model->m_headerFormat;
2849 d->m_model->m_headerFormat =
format;
2850 d->cachedSizeHint =
QSize();
2851 d->m_view->viewport()->update();
2852 d->m_view->updateGeometry();
2863 return d->m_model->m_dayFormats.value(dayOfWeek);
2876 d->m_model->m_dayFormats[dayOfWeek] =
format;
2877 d->cachedSizeHint =
QSize();
2878 d->m_view->viewport()->update();
2879 d->m_view->updateGeometry();
2889 return d->m_model->m_dateFormats;
2899 return d->m_model->m_dateFormats.value(
date);
2911 d->m_model->m_dateFormats.clear();
2914 d->m_view->viewport()->update();
2915 d->m_view->updateGeometry();
2939 return d->m_dateEditEnabled;
2948 d->m_dateEditEnabled =
enable;
2968 return d->m_navigator->dateEditAcceptDelay();
2974 d->m_navigator->setDateEditAcceptDelay(delay);
2988 qWarning(
"QCalendarWidget::updateCell: Invalid date");
3005 d->m_view->viewport()->update(
d->m_view->visualRect(modelIndex));
3019 d->m_view->viewport()->update();
3078 return d->navBarVisible;
3086 d->cachedSizeHint =
QSize();
3087 d->navBarBackground->setVisible(
visible);
3097 switch (
event->type()) {
3099 d->updateButtonIcons();
3103 d->cachedSizeHint =
QSize();
3104 d->updateMonthMenuNames();
3105 d->updateNavigationBar();
3106 d->m_view->updateGeometry();
3113 d->cachedSizeHint =
QSize();
3114 d->m_view->updateGeometry();
3117 d->cachedSizeHint =
QSize();
3118 d->m_view->updateGeometry();
3146 d->_q_yearEditingFinished();
3174 if (
d->yearEdit->isVisible() &&
event->size().width() !=
event->oldSize().width())
3175 d->_q_yearEditingFinished();
3185#if QT_CONFIG(shortcut)
3189 d->_q_yearEditingFinished();
3198#include "qcalendarwidget.moc"
3199#include "moc_qcalendarwidget.cpp"
void endRemoveRows()
Ends a row removal operation.
void beginRemoveColumns(const QModelIndex &parent, int first, int last)
Begins a column removal operation.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
This signal is emitted whenever the data in an existing item changes.
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
void beginInsertColumns(const QModelIndex &parent, int first, int last)
Begins a column insertion operation.
void endInsertRows()
Ends a row insertion operation.
void endRemoveColumns()
Ends a column removal operation.
void endInsertColumns()
Ends a column insertion operation.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
bool event(QEvent *event) override
\reimp
void mouseReleaseEvent(QMouseEvent *event) override
This function is called with the given event when a mouse button is released, after a mouse press eve...
QModelIndex currentIndex() const
Returns the model index of the current item.
void keyPressEvent(QKeyEvent *event) override
This function is called with the given event when a key event is sent to the widget.
void setTabKeyNavigation(bool enable)
CursorAction
This enum describes the different ways to navigate between items,.
void mousePressEvent(QMouseEvent *event) override
This function is called with the given event when a mouse button is pressed while the cursor is insid...
void mouseMoveEvent(QMouseEvent *event) override
This function is called with the given event when a mouse move event is sent to the widget.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void mouseDoubleClickEvent(QMouseEvent *event) override
This function is called with the given event when a mouse button is double clicked inside the widget.
void selectAll()
Selects all the text in the spinbox except the prefix and suffix.
QString text
the spin box's text, including any prefix and suffix
QSize sizeHint() const override
\reimp
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the data in row and column with parent.
QObject * parent() const
Returns a pointer to the parent object.
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
The QAction class provides an abstraction for user commands that can be added to different user inter...
QVariant data() const
Returns the user data as set in QAction::setData.
QString text
the action's descriptive text
void setData(const QVariant &var)
Sets the action's internal data to the given data.
void start(int msec, QObject *obj)
\obsolete Use chrono overload instead.
int timerId() const noexcept
Returns the timer's ID.
void stop()
Stops the timer.
The QCalendar class describes calendar systems.
QString standaloneMonthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised standalone name for a month.
int maximumMonthsInYear() const
Returns the largest number of months that any year may contain.
int monthsInYear(int year) const
Returns the number of months in the given year.
int dayOfWeek(QDate date) const
Returns the day of the week number for the given date.
\inmodule QtCore \reentrant
int weekNumber(int *yearNum=nullptr) const
Returns the ISO 8601 week number (1 to 53).
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
int month() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr QDate fromJulianDay(qint64 jd_)
Converts the Julian day jd to a QDate.
int day() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDate addDays(qint64 days) const
Returns a QDate object containing a date ndays later than the date of this object (or earlier if nday...
QDate addYears(int years) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr bool isNull() const
Returns true if the date is null; otherwise returns false.
int year() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDate addMonths(int months) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QDate currentDate()
Returns the system clock's current date.
int dayOfWeek() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool setDate(int year, int month, int day)
Type type() const
Returns the event type.
\reentrant \inmodule QtGui
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
The QFrame class is the base class of widgets that can have a frame.
QSize sizeHint() const override
\reimp
void setFrameShape(Shape)
void setFrameShadow(Shadow)
The QHBoxLayout class lines up widgets horizontally.
virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
virtual void clear()
Clears the selection model.
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
The QLabel widget provides a text or image display.
void setText(const QString &)
void setContentsMargins(int left, int top, int right, int bottom)
QString dateFormat(FormatType format=LongFormat) const
QString dayName(int, FormatType format=LongFormat) const
T value(const Key &key, const T &defaultValue=T()) const
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
QObject * parent() const
Returns a pointer to the parent object.
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
void deleteLater()
\threadsafe
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
The QPalette class contains color groups for each widget state.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QResizeEvent class contains event parameters for resize events.
constexpr int width() const noexcept
Returns the width.
The QSpacerItem class provides blank space in a layout.
void changeSize(int w, int h, QSizePolicy::Policy hData=QSizePolicy::Minimum, QSizePolicy::Policy vData=QSizePolicy::Minimum)
Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hPolic...
The QSpinBox class provides a spin box widget.
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
QString mid(qsizetype position, qsizetype n=-1) const &
qsizetype size() const noexcept
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
@ SH_ItemView_ActivateItemOnSingleClick
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Renders the delegate using the given painter and style option for the item specified by index.
The QTableView class provides a default model/view implementation of a table view.
QModelIndex indexAt(const QPoint &p) const override
Returns the index position of the model item corresponding to the table item at position pos in conte...
void setShowGrid(bool show)
void updateGeometries() override
\reimp
QHeaderView * horizontalHeader() const
Returns the table view's horizontal header.
QHeaderView * verticalHeader() const
Returns the table view's vertical header.
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
Moves the cursor in accordance with the given cursorAction, using the information provided by the mod...
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
The QVBoxLayout class lines up widgets vertically.
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
virtual Section handleKey(int key)=0
virtual void setDate(QDate date, QCalendar cal=QCalendar())=0
virtual QDate applyToDate(QDate date, QCalendar cal=QCalendar()) const =0
QCalendarDateSectionValidator()
virtual QString text(QDate date, QCalendar cal, int repeat) const =0
static QString highlightString(const QString &str, int pos)
virtual QString text() const =0
virtual ~QCalendarDateSectionValidator()
void setLocale(const QLocale &locale)
void setInitialDate(QDate date, QCalendar cal)
~QCalendarDateValidator()
void handleKeyEvent(QKeyEvent *keyEvent, QCalendar cal)
void setFormat(const QString &format)
QString currentText(QCalendar cal) const
QDate currentDate() const
virtual QDate applyToDate(QDate date, QCalendar cal) const override
virtual Section handleKey(int key) override
virtual void setDate(QDate date, QCalendar cal) override
virtual QString text() const override
void paintCell(QPainter *painter, const QRect &rect, QDate date) const
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent=nullptr)
QString dayName(Qt::DayOfWeek day) const
void showMonth(int year, int month)
QCalendar calendar() const
QTextCharFormat formatForCell(int row, int col) const
int columnCount(const QModelIndex &parent) const override
Returns the number of columns for the children of the given parent.
QCalendarWidget::HorizontalHeaderFormat m_horizontalHeaderFormat
QTextCharFormat m_headerFormat
QString monthName(const QLocale &locale, int month)
void setFirstColumnDay(Qt::DayOfWeek dayOfWeek)
int columnForDayOfWeek(Qt::DayOfWeek day) const
void setCalendar(QCalendar c)
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
QMap< QDate, QTextCharFormat > m_dateFormats
int columnForFirstOfMonth(QDate date) const
void setMinimumDate(QDate date)
void cellForDate(QDate date, int *row, int *column) const
bool weekNumbersShown() const
QVariant data(const QModelIndex &index, int role) const override
Returns the data stored under the given role for the item referred to by the index.
void setMaximumDate(QDate date)
StaticDayOfWeekAssociativeArray< QTextCharFormat > m_dayFormats
Qt::DayOfWeek firstColumnDay() const
QCalendarModel(QObject *parent=nullptr)
void setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat format)
Qt::DayOfWeek dayOfWeekForColumn(int section) const
QDate referenceDate() const
void setView(QCalendarView *view)
int rowCount(const QModelIndex &parent) const override
Returns the number of rows under the given parent.
void setRange(QDate min, QDate max)
QDate dateForCell(int row, int column) const
void setWeekNumbersShown(bool show)
virtual QDate applyToDate(QDate date, QCalendar cal) const override
QCalendarMonthValidator()
virtual Section handleKey(int key) override
virtual void setDate(QDate date, QCalendar cal) override
virtual QString text() const override
int dateEditAcceptDelay() const
void setDateEditAcceptDelay(int delay)
void timerEvent(QTimerEvent *e) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void setWidget(QWidget *widget)
void dateChanged(QDate date)
bool eventFilter(QObject *o, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
QCalendarTextNavigator(QObject *parent=nullptr)
virtual void keyboardSearch(const QString &) override
Moves to and selects the item best matching the string search.
void mouseReleaseEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
bool event(QEvent *event) override
void keyPressEvent(QKeyEvent *event) override
void changeDate(QDate date, bool changeMonth)
void setReadOnly(bool enable)
QDate handleMouseEvent(QMouseEvent *event)
QCalendarView(QWidget *parent=nullptr)
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
void mouseDoubleClickEvent(QMouseEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
void showDate(QDate date)
virtual QDate applyToDate(QDate date, QCalendar cal) const override
virtual void setDate(QDate date, QCalendar cal) override
virtual Section handleKey(int key) override
virtual QString text() const override
constexpr StaticDayOfWeekAssociativeArray() noexcept(noexcept(T()))
constexpr void insert(Qt::DayOfWeek day, T v) noexcept
constexpr const T & value(Qt::DayOfWeek day) const noexcept
constexpr T & operator[](Qt::DayOfWeek day) noexcept
constexpr bool contains(Qt::DayOfWeek day) const noexcept
EGLImageKHR int int EGLuint64KHR * modifiers
Combined button and popup list for selecting options.
constexpr const T & min(const T &a, const T &b)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept
#define QT_WARNING_DISABLE_MSVC(number)
static QString header(const QString &name)
static const qint64 headerSize
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
static QString quote(const QString &str)
QVideoFrameFormat::PixelFormat fmt
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
constexpr SectionToken(QCalendarDateSectionValidator *v, int rep)
QCalendarDateSectionValidator * validator