MonthGrid: remove "pressed" context property

This isn't documented or tested, and it's possible to
achieve using interactive controls like ItemDelegate
or e.g. TapHandler.

Pick-to: 6.5 6.6
Fixes: QTBUG-114358
Change-Id: If9ac3d74f30439db774386eb5d598d8116997979
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Ulf Hermann 2023-06-07 15:38:42 +02:00
parent 728744357c
commit 9831b38fc5
1 changed files with 0 additions and 21 deletions

View File

@ -92,8 +92,6 @@ public:
bool handleRelease(const QPointF &point, ulong timestamp) override;
void handleUngrab() override;
static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
QString title;
QVariant source;
QDate pressedDate;
@ -141,7 +139,6 @@ void QQuickMonthGridPrivate::updatePress(const QPointF &pos)
Q_Q(QQuickMonthGrid);
clearPress(false);
pressedItem = cellAt(pos);
setContextProperty(pressedItem, QStringLiteral("pressed"), true);
pressedDate = dateOf(pressedItem);
if (pressedDate.isValid())
emit q->pressed(pressedDate);
@ -150,7 +147,6 @@ void QQuickMonthGridPrivate::updatePress(const QPointF &pos)
void QQuickMonthGridPrivate::clearPress(bool clicked)
{
Q_Q(QQuickMonthGrid);
setContextProperty(pressedItem, QStringLiteral("pressed"), false);
if (pressedDate.isValid()) {
emit q->released(pressedDate);
if (clicked)
@ -190,16 +186,6 @@ void QQuickMonthGridPrivate::handleUngrab()
clearPress(false);
}
void QQuickMonthGridPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
{
QQmlContext *context = qmlContext(item);
if (context && context->isValid()) {
context = context->parentContext();
if (context && context->isValid())
context->setContextProperty(name, value);
}
}
QQuickMonthGrid::QQuickMonthGrid(QQuickItem *parent) :
QQuickControl(*(new QQuickMonthGridPrivate), parent)
{
@ -357,13 +343,6 @@ void QQuickMonthGrid::componentComplete()
{
Q_D(QQuickMonthGrid);
QQuickControl::componentComplete();
if (d->contentItem) {
const auto childItems = d->contentItem->childItems();
for (QQuickItem *child : childItems) {
if (!QQuickItemPrivate::get(child)->isTransparentForPositioner())
d->setContextProperty(child, QStringLiteral("pressed"), false);
}
}
d->resizeItems();
}