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;
153 if (!parts.isValid())
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;
258 if (!parts.isValid())
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;
366 if (!parts.isValid())
369 parts.year =
qMax(1, m_year);
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);
715void QCalendarTextNavigator::removeDateLabel()
719 m_acceptTimer.
stop();
722 delete m_dateValidator;
723 m_dateFrame =
nullptr;
724 m_dateText =
nullptr;
725 m_dateValidator =
nullptr;
738#if QT_CONFIG(shortcut)
767 if (
e->timerId() == m_acceptTimer.
timerId()) {
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) {
1017 const int requestedDay =
1019 return refDate.
addDays(requestedDay);
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)
1330 switch (cursorAction) {
1332 currentDate = currentDate.
addDays(-7);
1335 currentDate = currentDate.
addDays(7);
1345 if (parts.isValid()) {
1353 if (parts.isValid()) {
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;
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)
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();
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);
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()));
2165 setDateEditEnabled(
true);
2189 if (
d->cachedSizeHint.isValid())
2190 return d->cachedSizeHint;
2208 for (
int i = 1;
i <= 7;
i++) {
2218 for (
int i = 1;
i <= 6;
i++) {
2220 for (
int j = 1;
j <
end;
j++)
2227 for (
int i = 1;
i <=
end;
i++) {
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++) {
2258 const int buttonDecoMargin =
d->monthButton->sizeHint().width() - fm.
boundingRect(
d->monthButton->text()).
width();
2259 headerW += monthW + buttonDecoMargin;
2261 fm =
d->yearButton->fontMetrics();
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);
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));
2526 d->m_navigator->setDate(newDate);
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));
2582 d->m_navigator->setDate(newDate);
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));
2628 d->m_navigator->setDate(newDate);
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();
2737 return d->m_model->m_calendar;
2743 d->m_model->setCalendar(
c);
2744 d->updateMonthMenuNames();
2745 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year(
d->m_model->m_calendar));
2746 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year(
d->m_model->m_calendar));
2747 d->updateNavigationBar();
2753 d->m_view->setShowGrid(
show);
2754 d->cachedSizeHint =
QSize();
2755 d->m_view->viewport()->update();
2756 d->m_view->updateGeometry();
2803 d->m_model->setFirstColumnDay(dayOfWeek);
2819 return d->m_model->m_headerFormat;
2832 d->m_model->m_headerFormat =
format;
2833 d->cachedSizeHint =
QSize();
2834 d->m_view->viewport()->update();
2835 d->m_view->updateGeometry();
2846 return d->m_model->m_dayFormats.value(dayOfWeek);
2859 d->m_model->m_dayFormats[dayOfWeek] =
format;
2860 d->cachedSizeHint =
QSize();
2861 d->m_view->viewport()->update();
2862 d->m_view->updateGeometry();
2872 return d->m_model->m_dateFormats;
2882 return d->m_model->m_dateFormats.value(
date);
2894 d->m_model->m_dateFormats.clear();
2897 d->m_view->viewport()->update();
2898 d->m_view->updateGeometry();
2922 return d->m_dateEditEnabled;
2931 d->m_dateEditEnabled =
enable;
2951 return d->m_navigator->dateEditAcceptDelay();
2957 d->m_navigator->setDateEditAcceptDelay(delay);
2971 qWarning(
"QCalendarWidget::updateCell: Invalid date");
2988 d->m_view->viewport()->update(
d->m_view->visualRect(modelIndex));
3002 d->m_view->viewport()->update();
3061 return d->navBarVisible;
3069 d->cachedSizeHint =
QSize();
3070 d->navBarBackground->setVisible(
visible);
3080 switch (
event->type()) {
3082 d->updateButtonIcons();
3086 d->cachedSizeHint =
QSize();
3087 d->updateMonthMenuNames();
3088 d->updateNavigationBar();
3089 d->m_view->updateGeometry();
3096 d->cachedSizeHint =
QSize();
3097 d->m_view->updateGeometry();
3100 d->cachedSizeHint =
QSize();
3101 d->m_view->updateGeometry();
3128 d->_q_yearEditingFinished();
3156 if (
d->yearEdit->isVisible() &&
event->size().width() !=
event->oldSize().width())
3157 d->_q_yearEditingFinished();
3167#if QT_CONFIG(shortcut)
3171 d->_q_yearEditingFinished();
3180#include "qcalendarwidget.moc"
3181#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.
int count() const override
\reimp
void insertStretch(int index, int stretch=0)
Inserts a stretchable space (a QSpacerItem) at position index, with zero minimum size and stretch fac...
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void addItem(QLayoutItem *) override
\reimp
void setSpacing(int spacing) override
Reimplements QLayout::setSpacing().
The QCalendar class describes calendar systems.
QDate dateFromParts(int year, int month, int day) const
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.
YearMonthDay partsFromDate(QDate date) const
Converts a QDate to a year, month, and day of the 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.
int daysInMonth(int month, int year=Unspecified) const
Returns the number of days in the given month of the given year.
bool isPrint() const noexcept
Returns true if the character is a printable character; otherwise returns false.
\inmodule QtCore \reentrant
int weekNumber(int *yearNum=nullptr) const
Returns the ISO 8601 week number (1 to 53).
qint64 daysTo(QDate d) const
Returns the number of days from this date to d (which is negative if d is earlier than this date).
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...
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
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.
QString text() const
Returns the Unicode text that this key generated.
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 int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
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.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color 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
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
\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...
constexpr int width() const noexcept
Returns the width of the rectangle.
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 rightJustified(qsizetype width, QChar fill=u' ', bool trunc=false) const
Returns a string of size() width that contains the fill character followed by the string.
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
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...
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
The QStyleOption class stores the parameters used by QStyle functions.
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...
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)
#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
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent