aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/calendar/qquickmonthgrid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/calendar/qquickmonthgrid.cpp')
-rw-r--r--src/imports/calendar/qquickmonthgrid.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/imports/calendar/qquickmonthgrid.cpp b/src/imports/calendar/qquickmonthgrid.cpp
index fde4a71d..d03067ff 100644
--- a/src/imports/calendar/qquickmonthgrid.cpp
+++ b/src/imports/calendar/qquickmonthgrid.cpp
@@ -39,7 +39,7 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQml/qqmlinfo.h>
QT_BEGIN_NAMESPACE
@@ -73,12 +73,36 @@ QT_BEGIN_NAMESPACE
\sa DayOfWeekRow, WeekNumberColumn, CalendarModel
*/
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::pressed(date date)
+
+ This signal is emitted when \a date is pressed.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::released(date date)
+
+ This signal is emitted when \a date is released.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::clicked(date date)
+
+ This signal is emitted when \a date is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::pressAndHold(date date)
+
+ This signal is emitted when \a date is pressed and held down.
+*/
+
class QQuickMonthGridPrivate : public QQuickControlPrivate
{
Q_DECLARE_PUBLIC(QQuickMonthGrid)
public:
- QQuickMonthGridPrivate() : pressTimer(0), pressedItem(Q_NULLPTR), model(Q_NULLPTR), delegate(Q_NULLPTR) { }
+ QQuickMonthGridPrivate() : pressTimer(0), pressedItem(nullptr), model(nullptr), delegate(nullptr) { }
void resizeItems();
@@ -108,7 +132,8 @@ void QQuickMonthGridPrivate::resizeItems()
itemSize.setWidth((contentItem->width() - 6 * spacing) / 7);
itemSize.setHeight((contentItem->height() - 5 * spacing) / 6);
- foreach (QQuickItem *item, contentItem->childItems())
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *item : childItems)
item->setSize(itemSize);
}
@@ -119,7 +144,7 @@ QQuickItem *QQuickMonthGridPrivate::cellAt(const QPoint &pos) const
QPointF mapped = q->mapToItem(contentItem, pos);
return contentItem->childAt(mapped.x(), mapped.y());
}
- return Q_NULLPTR;
+ return nullptr;
}
QDate QQuickMonthGridPrivate::dateOf(QQuickItem *cell) const
@@ -150,7 +175,7 @@ void QQuickMonthGridPrivate::clearPress(bool clicked)
emit q->clicked(pressedDate);
}
pressedDate = QDate();
- pressedItem = Q_NULLPTR;
+ pressedItem = nullptr;
}
void QQuickMonthGridPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
@@ -335,7 +360,8 @@ void QQuickMonthGrid::componentComplete()
Q_D(QQuickMonthGrid);
QQuickControl::componentComplete();
if (d->contentItem) {
- foreach (QQuickItem *child, d->contentItem->childItems()) {
+ const auto childItems = d->contentItem->childItems();
+ for (QQuickItem *child : childItems) {
if (!QQuickItemPrivate::get(child)->isTransparentForPositioner())
d->setContextProperty(child, QStringLiteral("pressed"), false);
}