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:
parent
728744357c
commit
9831b38fc5
|
@ -92,8 +92,6 @@ public:
|
||||||
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
bool handleRelease(const QPointF &point, ulong timestamp) override;
|
||||||
void handleUngrab() override;
|
void handleUngrab() override;
|
||||||
|
|
||||||
static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
|
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
QVariant source;
|
QVariant source;
|
||||||
QDate pressedDate;
|
QDate pressedDate;
|
||||||
|
@ -141,7 +139,6 @@ void QQuickMonthGridPrivate::updatePress(const QPointF &pos)
|
||||||
Q_Q(QQuickMonthGrid);
|
Q_Q(QQuickMonthGrid);
|
||||||
clearPress(false);
|
clearPress(false);
|
||||||
pressedItem = cellAt(pos);
|
pressedItem = cellAt(pos);
|
||||||
setContextProperty(pressedItem, QStringLiteral("pressed"), true);
|
|
||||||
pressedDate = dateOf(pressedItem);
|
pressedDate = dateOf(pressedItem);
|
||||||
if (pressedDate.isValid())
|
if (pressedDate.isValid())
|
||||||
emit q->pressed(pressedDate);
|
emit q->pressed(pressedDate);
|
||||||
|
@ -150,7 +147,6 @@ void QQuickMonthGridPrivate::updatePress(const QPointF &pos)
|
||||||
void QQuickMonthGridPrivate::clearPress(bool clicked)
|
void QQuickMonthGridPrivate::clearPress(bool clicked)
|
||||||
{
|
{
|
||||||
Q_Q(QQuickMonthGrid);
|
Q_Q(QQuickMonthGrid);
|
||||||
setContextProperty(pressedItem, QStringLiteral("pressed"), false);
|
|
||||||
if (pressedDate.isValid()) {
|
if (pressedDate.isValid()) {
|
||||||
emit q->released(pressedDate);
|
emit q->released(pressedDate);
|
||||||
if (clicked)
|
if (clicked)
|
||||||
|
@ -190,16 +186,6 @@ void QQuickMonthGridPrivate::handleUngrab()
|
||||||
clearPress(false);
|
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) :
|
QQuickMonthGrid::QQuickMonthGrid(QQuickItem *parent) :
|
||||||
QQuickControl(*(new QQuickMonthGridPrivate), parent)
|
QQuickControl(*(new QQuickMonthGridPrivate), parent)
|
||||||
{
|
{
|
||||||
|
@ -357,13 +343,6 @@ void QQuickMonthGrid::componentComplete()
|
||||||
{
|
{
|
||||||
Q_D(QQuickMonthGrid);
|
Q_D(QQuickMonthGrid);
|
||||||
QQuickControl::componentComplete();
|
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();
|
d->resizeItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue