44 #ifndef QT_NO_CALENDARWIDGET 54 #include <private/qwidget_p.h> 63 #include <private/qcalendartextnavigator_p.h> 104 int startPos = str.
length() - pos;
210 }
else if (repeat == 2) {
212 if (date.
day() / 10 == 0)
215 }
else if (repeat == 3) {
217 }
else if (repeat >= 4) {
303 int day = date.
day();
304 if (day > newDate.daysInMonth())
305 day = newDate.daysInMonth();
328 }
else if (repeat == 2) {
330 if (date.
month() / 10 == 0)
333 }
else if (repeat == 3) {
367 for (
int i = 0; i < n; i++)
416 int day = date.
day();
417 if (day > newDate.daysInMonth())
418 day = newDate.daysInMonth();
432 for (
int i = 0; i < 3; i++) {
445 int year = date.
year() % 100;
465 void setInitialDate(
const QDate &date);
467 void setLocale(
const QLocale &locale);
478 void toPreviousToken();
527 const QChar ch = str.
at(index);
528 while (index + count < str.
size() && str.
at(index + count) == ch)
547 QListIterator<SectionToken *> itTok(
m_tokens);
548 while (itSep.hasNext()) {
550 if (itTok.hasNext()) {
554 str += validator->
text();
580 bool quoting =
false;
582 while (pos < format.
size()) {
589 const QChar nextChar = format.
at(pos);
591 separator += nextChar;
604 separator += nextChar;
655 int key = keyEvent->
key();
699 m_acceptTimer.start(m_editDelay,
this);
701 m_dateText->setText(m_dateValidator->currentText());
703 QSize s = m_dateFrame->sizeHint();
704 QRect r = m_widget->geometry();
706 m_dateFrame->setGeometry(newRect);
709 QPalette p = m_dateFrame->palette();
711 m_dateFrame->setPalette(p);
713 m_dateFrame->raise();
724 emit dateChanged(date);
731 m_dateFrame =
new QFrame(m_widget);
735 m_dateFrame->setLayout(vl);
739 m_dateValidator->setLocale(m_widget->locale());
741 m_dateValidator->setInitialDate(m_date);
743 m_dateFrame->setAutoFillBackground(
true);
751 m_acceptTimer.stop();
753 m_dateFrame->deleteLater();
754 delete m_dateValidator;
765 if ((ke->
text().
length() > 0 && ke->
text()[0].isPrint()) || m_dateFrame) {
768 emit editingFinished();
774 m_dateValidator->handleKeyEvent(ke);
797 if (e->
timerId() == m_acceptTimer.timerId()) {
826 Qt::ItemFlags flags(
const QModelIndex &index)
const;
830 beginInsertRows(parent, row, row + count - 1);
836 beginInsertColumns(parent, column, column + count - 1);
842 beginRemoveRows(parent, row, row + count - 1);
848 beginRemoveColumns(parent, column, column + count - 1);
853 void showMonth(
int year,
int month);
854 void setDate(
const QDate &
d);
856 void setMinimumDate(
const QDate &date);
857 void setMaximumDate(
const QDate &date);
859 void setRange(
const QDate &min,
const QDate &max);
866 bool weekNumbersShown()
const;
867 void setWeekNumbersShown(
bool show);
872 QDate dateForCell(
int row,
int column)
const;
873 void cellForDate(
const QDate &date,
int *row,
int *column)
const;
879 void internalUpdate();
880 QDate referenceDate()
const;
881 int columnForFirstOfMonth(
const QDate &date)
const;
906 void setReadOnly(
bool enable);
910 void showDate(
const QDate &date);
911 void changeDate(
const QDate &date,
bool changeMonth);
912 void clicked(
const QDate &date);
913 void editingFinished();
920 #ifndef QT_NO_WHEELEVENT 931 #ifdef QT_KEYPAD_NAVIGATION 955 if (col < 0 || col > 6)
965 if (day < 1 || day > 7)
988 while (refDay <= 31) {
1015 const int requestedDay = 7 * (row -
m_firstRow) + column - columnForFirstOfShownMonth - refDate.
day() + 1;
1016 return refDate.
addDays(requestedDay);
1021 if (!row && !column)
1034 const int requestedPosition = refDate.
daysTo(date) -
m_firstColumn + columnForFirstOfShownMonth + refDate.
day() - 1;
1036 int c = requestedPosition % 7;
1037 int r = requestedPosition / 7;
1061 return standaloneDayName.
left(1);
1062 return standaloneDayName;
1118 int row = index.
row();
1119 int column = index.
column();
1284 validDateClicked(false)
1305 switch (cursorAction) {
1307 currentDate = currentDate.
addDays(-7);
1310 currentDate = currentDate.
addDays(7);
1325 currentDate = currentDate.
addMonths(-1);
1342 #ifdef QT_KEYPAD_NAVIGATION 1344 if (QApplication::keypadNavigationEnabled()) {
1345 if (!hasEditFocus()) {
1351 if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
1352 if (qobject_cast<QCalendarModel *>(
model())) {
1354 setEditFocus(
false);
1362 switch (event->
key()) {
1375 #ifndef QT_NO_WHEELEVENT 1378 const int numDegrees =
event->delta() / 8;
1379 const int numSteps = numDegrees / 15;
1382 currentDate = currentDate.
addMonths(-numSteps);
1389 #ifdef QT_KEYPAD_NAVIGATION 1392 origDate = calendarModel->m_date;
1419 if (!calendarModel) {
1437 if (!calendarModel) {
1451 int row = -1, col = -1;
1453 if (row != -1 && col != -1) {
1465 if (!calendarModel) {
1476 int row = -1, col = -1;
1478 if (row != -1 && col != -1) {
1490 if (!calendarModel) {
1545 initStyleOption(&opt);
1570 initStyleOption(&opt);
1582 void showMonth(
int year,
int month);
1586 void _q_slotShowDate(
const QDate &date);
1587 void _q_slotChangeDate(
const QDate &date);
1588 void _q_slotChangeDate(
const QDate &date,
bool changeMonth);
1589 void _q_editingFinished();
1590 void _q_monthChanged(
QAction*);
1591 void _q_prevMonthClicked();
1592 void _q_nextMonthClicked();
1593 void _q_yearEditingFinished();
1594 void _q_yearClicked();
1597 void updateButtonIcons();
1598 void updateMonthMenu();
1599 void updateMonthMenuNames();
1600 void updateNavigationBar();
1601 void updateCurrentPage(
const QDate &newDate);
1602 inline QDate getCurrentDate();
1603 void setNavigatorEnabled(
bool enable);
1630 QDate date = calendarWidgetPrivate->m_model->dateForCell(index.
row(), index.
column());
1632 storedOption = option;
1634 calendarWidgetPrivate->paintCell(painter, rect, date);
1642 storedOption.rect =
rect;
1645 calendarWidgetPrivate->m_model->cellForDate(date, &row, &col);
1646 QModelIndex idx = calendarWidgetPrivate->m_model->index(row, col);
1668 if (enable == navigatorEnabled)
1712 for (
int i = 1; i <= 12; i++) {
1724 QFont font = q->font();
1772 int beg = 1,
end = 12;
1773 bool prevEnabled =
true;
1774 bool nextEnabled =
true;
1778 prevEnabled =
false;
1783 nextEnabled =
false;
1787 for (
int i = 1; i <= 12; i++) {
1788 bool monthEnabled =
true;
1789 if (i < beg || i >
end)
1790 monthEnabled =
false;
1799 for (
int i = 1; i <= 12; i++) {
1809 QDate newDate = date;
1810 QDate minDate = q->minimumDate();
1811 QDate maxDate = q->maximumDate();
1817 int row = -1, col = -1;
1819 if (row != -1 && col != -1)
1858 qApp->removeEventFilter(q);
1877 qApp->installEventFilter(q);
1890 emit q->currentPageChanged(year, month);
1915 if (row != -1 && column != -1) {
1924 q->paintCell(painter, rect, date);
1944 if (oldDate != newDate) {
1948 emit q->selectionChanged();
2068 d->m_view->setObjectName(
QLatin1String(
"qt_calendar_calendarview"));
2069 d->m_view->setModel(
d->m_model);
2070 d->m_model->setView(
d->m_view);
2074 d->m_view->horizontalHeader()->setClickable(
false);
2076 d->m_view->verticalHeader()->setClickable(
false);
2077 d->m_selection =
d->m_view->selectionModel();
2078 d->createNavigationBar(
this);
2081 d->m_view->setItemDelegate(
d->m_delegate);
2083 d->updateNavigationBar();
2091 this,
SLOT(_q_slotChangeDate(
QDate,
bool)));
2095 this,
SLOT(_q_editingFinished()));
2098 this,
SLOT(_q_prevMonthClicked()));
2100 this,
SLOT(_q_nextMonthClicked()));
2102 this,
SLOT(_q_yearClicked()));
2106 this,
SLOT(_q_yearEditingFinished()));
2138 if (
d->cachedSizeHint.isValid())
2139 return d->cachedSizeHint;
2155 for (
int i = 1; i <= 7; i++) {
2157 w =
qMax(w, fm.width(
d->m_model->dayName(
d->m_model->dayOfWeekForColumn(i))) + marginH);
2158 h =
qMax(h, fm.height());
2165 for (
int i = 1; i <= 6; i++) {
2167 for (
int j = 1; j <
end; j++)
2169 h =
qMax(h, fm.height());
2174 for (
int i = 1; i <=
end; i++) {
2176 h =
qMax(h, fm.height());
2179 if (
d->m_view->showGrid()) {
2187 h =
qMax(h,
d->m_view->verticalHeader()->minimumSectionSize());
2188 w =
qMax(w,
d->m_view->horizontalHeader()->minimumSectionSize());
2191 QSize headerSize(0, 0);
2192 if (
d->navBarVisible) {
2193 int headerH =
d->navBarBackground->sizeHint().height();
2196 headerW +=
d->prevMonth->sizeHint().width();
2197 headerW +=
d->nextMonth->sizeHint().width();
2201 for (
int i = 1; i < 12; i++) {
2205 const int buttonDecoMargin =
d->monthButton->sizeHint().width() - fm.
boundingRect(
d->monthButton->text()).
width();
2206 headerW += monthW + buttonDecoMargin;
2208 fm =
d->yearButton->fontMetrics();
2211 headerSize =
QSize(headerW, headerH);
2214 w =
qMax(headerSize.width(), w);
2215 h = (h * rows) + headerSize.height();
2216 d->cachedSizeHint =
QSize(w, h);
2217 return d->cachedSizeHint;
2227 d->m_delegate->paintCell(painter, rect, date);
2247 return d->m_model->m_date;
2253 if (
d->m_model->m_date == date && date ==
d->getCurrentDate())
2259 d->m_model->setDate(date);
2261 QDate newDate =
d->m_model->m_date;
2262 d->showMonth(newDate.
year(), newDate.
month());
2276 return d->m_model->m_shownYear;
2289 return d->m_model->m_shownMonth;
2307 QDate currentDate =
d->getCurrentDate();
2308 int day = currentDate.
day();
2310 if (day > daysInMonths)
2313 d->showMonth(year, month);
2315 QDate newDate(year, month, day);
2316 int row = -1, col = -1;
2317 d->m_model->cellForDate(newDate, &row, &col);
2318 if (row != -1 && col != -1) {
2319 d->m_view->selectionModel()->setCurrentIndex(
d->m_model->index(row, col),
2449 return d->m_model->m_minimumDate;
2455 if (!date.
isValid() ||
d->m_model->m_minimumDate == date)
2458 QDate oldDate =
d->m_model->m_date;
2459 d->m_model->setMinimumDate(date);
2460 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year());
2461 d->updateMonthMenu();
2462 QDate newDate =
d->m_model->m_date;
2463 if (oldDate != newDate) {
2465 d->showMonth(newDate.
year(), newDate.
month());
2466 d->m_navigator->setDate(newDate);
2502 return d->m_model->m_maximumDate;
2508 if (!date.
isValid() ||
d->m_model->m_maximumDate == date)
2511 QDate oldDate =
d->m_model->m_date;
2512 d->m_model->setMaximumDate(date);
2513 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year());
2514 d->updateMonthMenu();
2515 QDate newDate =
d->m_model->m_date;
2516 if (oldDate != newDate) {
2518 d->showMonth(newDate.
year(), newDate.
month());
2519 d->m_navigator->setDate(newDate);
2546 if (
d->m_model->m_minimumDate == min &&
d->m_model->m_maximumDate == max)
2551 QDate oldDate =
d->m_model->m_date;
2552 d->m_model->setRange(min, max);
2553 d->yearEdit->setMinimum(
d->m_model->m_minimumDate.year());
2554 d->yearEdit->setMaximum(
d->m_model->m_maximumDate.year());
2555 d->updateMonthMenu();
2556 QDate newDate =
d->m_model->m_date;
2557 if (oldDate != newDate) {
2559 d->showMonth(newDate.
year(), newDate.
month());
2560 d->m_navigator->setDate(newDate);
2594 if (
d->m_model->m_horizontalHeaderFormat == format)
2597 d->m_model->setHorizontalHeaderFormat(format);
2598 d->cachedSizeHint =
QSize();
2599 d->m_view->viewport()->update();
2600 d->m_view->updateGeometry();
2606 return d->m_model->m_horizontalHeaderFormat;
2637 bool shown =
d->m_model->weekNumbersShown();
2649 if (
d->m_model->weekNumbersShown() ==
show)
2651 d->m_model->setWeekNumbersShown(show);
2652 d->cachedSizeHint =
QSize();
2653 d->m_view->viewport()->update();
2654 d->m_view->updateGeometry();
2677 return d->m_view->showGrid();
2683 d->m_view->setShowGrid(show);
2684 d->cachedSizeHint =
QSize();
2685 d->m_view->viewport()->update();
2686 d->m_view->updateGeometry();
2738 d->m_model->setFirstColumnDay(dayOfWeek);
2754 return d->m_model->m_headerFormat;
2767 d->m_model->m_headerFormat =
format;
2768 d->cachedSizeHint =
QSize();
2769 d->m_view->viewport()->update();
2770 d->m_view->updateGeometry();
2781 return d->m_model->m_dayFormats.value(dayOfWeek);
2794 d->m_model->m_dayFormats[dayOfWeek] =
format;
2795 d->cachedSizeHint =
QSize();
2796 d->m_view->viewport()->update();
2797 d->m_view->updateGeometry();
2807 return d->m_model->m_dateFormats;
2817 return d->m_model->m_dateFormats.value(date);
2829 d->m_model->m_dateFormats.clear();
2831 d->m_model->m_dateFormats[date] =
format;
2832 d->m_view->viewport()->update();
2833 d->m_view->updateGeometry();
2860 return d->m_dateEditEnabled;
2869 d->m_dateEditEnabled = enable;
2892 return d->m_navigator->dateEditAcceptDelay();
2898 d->m_navigator->setDateEditAcceptDelay(delay);
2915 qWarning(
"QCalendarWidget::updateCell: Invalid date");
2924 d->m_model->cellForDate(date, &row, &column);
2925 if (row == -1 || column == -1)
2928 QModelIndex modelIndex =
d->m_model->index(row, column);
2932 d->m_view->viewport()->update(
d->m_view->visualRect(modelIndex));
2949 d->m_view->viewport()->update();
3029 return d->navBarVisible;
3066 d->cachedSizeHint =
QSize();
3067 d->navBarBackground->setVisible(visible);
3077 switch (event->
type()) {
3079 d->updateButtonIcons();
3081 d->cachedSizeHint =
QSize();
3082 d->updateMonthMenuNames();
3083 d->updateNavigationBar();
3084 d->m_view->updateGeometry();
3088 d->cachedSizeHint =
QSize();
3089 d->m_view->updateGeometry();
3092 d->cachedSizeHint =
QSize();
3093 d->m_view->updateGeometry();
3111 if (widget->
window() == tlw) {
3112 QPoint mousePos = widget->
mapTo(tlw, static_cast<QMouseEvent *>(event)->
pos());
3116 d->_q_yearEditingFinished();
3145 if(
d->yearEdit->isVisible() &&
event->size().width() !=
event->oldSize().width())
3146 d->_q_yearEditingFinished();
3160 d->_q_yearEditingFinished();
3168 #include "qcalendarwidget.moc" 3169 #include "moc_qcalendarwidget.cpp" 3171 #endif //QT_NO_CALENDARWIDGET static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
SectionToken * m_currentToken
The QPainter class performs low-level painting on widgets and other paint devices.
int dayOfWeek() const
Returns the weekday (1 = Monday to 7 = Sunday) for this date.
virtual QDate applyToDate(const QDate &date) const
virtual ~QCalendarDateSectionValidator()
QFont font() const
Returns the font for this character format.
void setWidget(QWidget *widget)
void mouseMoveEvent(QMouseEvent *event)
This function is called with the given event when a mouse move event is sent to the widget...
QCalendarWidget::HorizontalHeaderFormat m_horizontalHeaderFormat
The QKeyEvent class describes a key event.
QVariant data(const QModelIndex &index, int role) const
Returns the data stored under the given role for the item referred to by the index.
The QItemSelectionModel class keeps track of a view's selected items.
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
virtual void clear()
Clears the selection model.
bool removeRow(int row, const QModelIndex &parent=QModelIndex())
Removes the given row from the child items of the parent specified.
int daysTo(const QDate &) const
Returns the number of days from this date to d (which is negative if d is earlier than this date)...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
bool isNull() const
Returns true if the date is null; otherwise returns false.
QPointer< QWidget > widget
void handleKeyEvent(QKeyEvent *keyEvent)
const QChar at(int i) const
Returns the character at the given index position in the string.
static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
bool isValid() const
Returns true if this date is valid; otherwise returns false.
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
Moves the cursor in accordance with the given cursorAction, using the information provided by the mod...
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
virtual QString text() const
void mouseMoveEvent(QMouseEvent *event)
This function is called with the given event when a mouse move event is sent to the widget...
QStyle::State state
the style flags that are used when drawing the control
#define it(className, varName)
void setDateEditAcceptDelay(int delay)
void mouseDoubleClickEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is double clicked inside the widget...
The QWheelEvent class contains parameters that describe a wheel event.
void mouseDoubleClickEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is double clicked inside the widget...
virtual Section handleKey(int key)
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
int length() const
Returns the number of characters in this string.
QString text
the action's descriptive text
int month() const
Returns the number corresponding to the month of this date, using the following convention: ...
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns the index of the data in row and column with parent.
QHeaderView * horizontalHeader() const
Returns the table view's horizontal header.
static void clear(QVariant::Private *d)
void setFont(const QFont &font)
Sets the text format's font.
void insertStretch(int index, int stretch=0)
Inserts a stretchable space (a QSpacerItem) at position index, with zero minimum size and stretch fac...
void mouseReleaseEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is released, after a mouse press eve...
int width() const
Returns the width of the rectangle.
virtual QDate applyToDate(const QDate &date) const
int weekNumber(int *yearNum=0) const
Returns the week number (1 to 53), and stores the year in {yearNumber} unless yearNumber is null (the...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
int day() const
Returns the day of the month (1 to 31) of this date.
The QDate class provides date functions.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int countRepeat(const QString &str, int index) const
QDate handleMouseEvent(QMouseEvent *event)
void showMonth(int year, int month)
void setBackground(const QBrush &brush)
Sets the brush use to paint the document's background to the brush specified.
int height() const
Returns the height of the rectangle.
QString highlightString(const QString &str, int pos) const
void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const
The QString class provides a Unicode character string.
static QDate fromJulianDay(int jd)
Converts the Julian day jd to a QDate.
T * qobject_cast(QObject *object)
int columnCount(const QModelIndex &) const
Returns the number of columns for the children of the given parent.
QDate addYears(int years) const
Returns a QDate object containing a date nyears later than the date of this object (or earlier if nye...
The QObject class is the base class of all Qt objects.
QDate addMonths(int months) const
Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nm...
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, inserts count rows into the model before the given row.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
The QChar class provides a 16-bit Unicode character.
bool eventFilter(QObject *o, QEvent *e)
Filters events if this object has been installed as an event filter for the watched object...
void changeDate(const QDate &date, bool changeMonth)
QMap< Qt::DayOfWeek, QTextCharFormat > m_dayFormats
void setData(const QVariant &var)
Sets the action's internal data to the given userData.
void showDate(const QDate &date)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void addItem(QLayoutItem *)
Reimplemented Function
QCalendarDelegate(QCalendarWidgetPrivate *w, QObject *parent=0)
void setMinimumDate(const QDate &date)
void setObjectName(const QString &name)
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
void keyPressEvent(QKeyEvent *event)
This function is called with the given event when a key event is sent to the widget.
static QCursor * moveCursor
void setTabKeyNavigation(bool enable)
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
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...
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
int key() const
Returns the code of the key that was pressed or released.
QCalendarDateSectionValidator * m_yearValidator
int width() const
Returns the width.
QCalendarModel(QObject *parent=0)
void append(const T &t)
Inserts value at the end of the list.
void setView(QCalendarView *view)
#define QT_BEGIN_NAMESPACE
This macro expands to.
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...
bool weekNumbersShown() const
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
~QCalendarDateValidator()
static int countRepeat(const QString &str, int index, int maxCount)
Parses the format newFormat.
void setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat format)
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
On models that support this, inserts count new columns into the model before the given column...
QDate dateForCell(int row, int column) const
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
QCalendarDateSectionValidator * validator
The QSpacerItem class provides blank space in a layout.
int size() const
Returns the number of characters in this string.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
int count() const
Reimplemented Function
bool insertRow(int row, const QModelIndex &parent=QModelIndex())
Inserts a single row before the given row in the child items of the parent specified.
static QDate currentDate()
Returns the current date, as reported by the system clock.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
virtual QDate applyToDate(const QDate &date) const
void wheelEvent(QWheelEvent *event)
This event handler can be reimplemented in a subclass to receive wheel events for the viewport() widg...
int row() const
Returns the row this model index refers to.
bool event(QEvent *event)
Reimplemented Function
virtual Section handleKey(int key)
QString currentText() const
const T value(const Key &key) const
Returns the value associated with the key key.
Qt::DayOfWeek dayOfWeekForColumn(int section) const
The QStringList class provides a list of strings.
void selectAll()
Selects all the text in the spinbox except the prefix and suffix.
The QResizeEvent class contains event parameters for resize events.
const char * styleHint(const QFontDef &request)
void setWeekNumbersShown(bool show)
Q_CORE_EXPORT void qWarning(const char *,...)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
QString toolTip() const
Returns the tool tip that is displayed for a fragment of text.
static const char * data(const QByteArray &arr)
void setShowGrid(bool show)
QCalendarDateSectionValidator * m_monthValidator
QHeaderView * verticalHeader() const
Returns the table view's vertical header.
QModelIndex currentIndex() const
Returns the model index of the current item.
virtual void setDate(const QDate &date)
void keyPressEvent(QKeyEvent *event)
This function is called with the given event when a key event is sent to the widget.
QDate addDays(int days) const
Returns a QDate object containing a date ndays later than the date of this object (or earlier if nday...
void cellForDate(const QDate &date, int *row, int *column) const
void clear()
Removes all items from the list.
void setMaximumDate(const QDate &date)
QBrush background() const
Returns the brush used to paint the document's background.
QCalendarView(QWidget *parent=0)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count rows starting with the given row under parent parent from ...
QMap< QDate, QTextCharFormat > m_dateFormats
Qt::MouseButton button() const
Returns the button that caused the event.
The QTableView class provides a default model/view implementation of a table view.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
virtual void setDate(const QDate &date)=0
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
QCalendarMonthValidator()
void qSwap(T &value1, T &value2)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
bool removeColumn(int column, const QModelIndex &parent=QModelIndex())
Removes the given column from the child items of the parent specified.
The QMouseEvent class contains parameters that describe a mouse event.
QStyleOptionViewItemV4 storedOption
void setInitialDate(const QDate &date)
int columnForDayOfWeek(Qt::DayOfWeek day) const
QList< SectionToken * > m_tokens
QString dayName(Qt::DayOfWeek day) const
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
int daysInMonth() const
Returns the number of days in the month (28 to 31) for this date.
bool insertColumn(int column, const QModelIndex &parent=QModelIndex())
Inserts a single column before the given column in the child items of the parent specified.
void setFirstColumnDay(Qt::DayOfWeek dayOfWeek)
QSize sizeHint() const
Reimplemented Function
#define Q_DECLARE_PUBLIC(Class)
QTextCharFormat formatForCell(int row, int col) const
virtual QString text() const
The QTimerEvent class contains parameters that describe a timer event.
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count columns starting with the given column under parent parent...
void merge(const QTextFormat &other)
Merges the other format with this format; where there are conflicts the other format takes precedence...
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
The QFont class specifies a font used for drawing text.
virtual Section handleKey(int key)=0
QCalendarDateSectionValidator::Section m_lastSectionMove
QString text() const
Returns the Unicode text that this key generated.
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
virtual QString text() const =0
The QItemDelegate class provides display and editing facilities for data items from a model...
void setSpacing(int spacing)
Reimplements QLayout::setSpacing().
QObject * parent() const
Returns a pointer to the parent object.
void setFormat(const QString &format)
The QPoint class defines a point in the plane using integer precision.
QVariant data() const
Returns the user data as set in QAction::setData.
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...
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
The QModelIndex class is used to locate data in a data model.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
static qlonglong pow10(int exp)
QString standaloneMonthName(int, FormatType format=LongFormat) const
Returns the localized name of month that is used as a standalone text, in the format specified by typ...
QBrush foreground() const
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This signal is emitted whenever the data in an existing item changes.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
SectionToken(QCalendarDateSectionValidator *val, int rep)
The QSpinBox class provides a spin box widget.
QListIterator< QString > QStringListIterator
The QLabel widget provides a text or image display.
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
Moves the cursor in accordance with the given cursorAction, using the information provided by the mod...
The QHBoxLayout class lines up widgets horizontally.
void mouseReleaseEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is released, after a mouse press eve...
void setDate(const QDate &d)
void clicked(const QDate &date)
QCalendarDateSectionValidator()
QCalendarDateSectionValidator * m_dayValidator
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget...
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
virtual void keyboardSearch(const QString &search)
Moves to and selects the item best matching the string search.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
int year() const
Returns the year of this date.
The QSize class defines the size of a two-dimensional object using integer point precision.
QTextCharFormat m_headerFormat
QString dayName(int, FormatType format=LongFormat) const
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on)...
virtual QString text() const
CursorAction
This enum describes the different ways to navigate between items,.
void setLocale(const QLocale &locale)
The QVBoxLayout class lines up widgets vertically.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt)
Use the widget's style to draw a complex control cc specified by the QStyleOptionComplex option...
The QPaintEvent class contains event parameters for paint events.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
static const KeyPair *const end
int rowCount(const QModelIndex &) const
Returns the number of rows under the given parent.
QDate referenceDate() const
bool event(QEvent *event)
Reimplemented Function
The QEvent class is the base class of all event classes.
virtual QDate applyToDate(const QDate &date) const =0
virtual void setDate(const QDate &date)
QDate currentDate() const
Type type() const
Returns the event type.
The QFrame class is the base class of widgets that can have a frame.
Qt::DayOfWeek firstColumnDay() const
void setRange(const QDate &min, const QDate &max)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
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...
void mousePressEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is pressed while the cursor is insid...
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
void mousePressEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is pressed while the cursor is insid...
QModelIndex indexAt(const QPoint &p) const
Returns the index position of the model item corresponding to the table item at position pos in conte...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
virtual void setDate(const QDate &date)
The QAction class provides an abstract user interface action that can be inserted into widgets...
int columnForFirstOfMonth(const QDate &date) const
QCalendarWidgetPrivate * calendarWidgetPrivate
The QAbstractTableModel class provides an abstract model that can be subclassed to create table model...
virtual Section handleKey(int key)
Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
void setDate(const QDate &date)
int dateEditAcceptDelay() const
QString standaloneDayName(int, FormatType format=LongFormat) const
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on) tha...
The QPalette class contains color groups for each widget state.