From a4a8ee48b09e578a1515dbea4fedace849c7e465 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 30 Dec 2015 13:47:59 +0100 Subject: QQuickFlipable: Set enabled property on whichever side is considered active. This fixes a regression in behavior whereby input is not blocked when the side changes. In QtQuick1, input was tied to opacity: items with a 0 opacity would not receive input. In QtQuick2, this is not the case. [ChangeLog][QtQuick][Flipable] Flipable now toggles the 'enabled' property on whichever side is active. This restores broken behavior compatibility with QtQuick1, and blocks input to whichever side is not active. Change-Id: I36e29089cd7ffd05bf1f415490e0e0816a86bf30 Task-number: QTBUG-37072 Reviewed-by: Michael Brasser --- src/quick/items/qquickflipable.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 4fd146f0e4..b0bacf0eb6 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -152,8 +152,10 @@ void QQuickFlipable::setFront(QQuickItem *front) } d->front = front; d->front->setParentItem(this); - if (Back == d->current) + if (Back == d->current) { d->front->setOpacity(0.); + d->front->setEnabled(false); + } emit frontChanged(); } @@ -178,8 +180,11 @@ void QQuickFlipable::setBack(QQuickItem *back) d->backTransform = new QQuickLocalTransform(d->back); d->backTransform->prependToItem(d->back); - if (Front == d->current) + if (Front == d->current) { d->back->setOpacity(0.); + d->back->setEnabled(false); + } + connect(back, SIGNAL(widthChanged()), this, SLOT(retransformBack())); connect(back, SIGNAL(heightChanged()), @@ -271,10 +276,14 @@ void QQuickFlipablePrivate::updateSide() current = newSide; if (current == QQuickFlipable::Back && back) setBackTransform(); - if (front) + if (front) { front->setOpacity((current==QQuickFlipable::Front)?1.:0.); - if (back) + front->setEnabled((current==QQuickFlipable::Front)?true:false); + } + if (back) { back->setOpacity((current==QQuickFlipable::Back)?1.:0.); + back->setEnabled((current==QQuickFlipable::Back)?true:false); + } emit q->sideChanged(); } } -- cgit v1.2.3