aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/util')
-rw-r--r--src/quick/util/qquickapplication.cpp2
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp5
-rw-r--r--src/quick/util/qquickforeignutils.cpp78
-rw-r--r--src/quick/util/qquickpath.cpp2
-rw-r--r--src/quick/util/qquicksvgparser.cpp12
-rw-r--r--src/quick/util/qquicktransition.cpp67
6 files changed, 117 insertions, 49 deletions
diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp
index 2cb8fe36ba..f56533e355 100644
--- a/src/quick/util/qquickapplication.cpp
+++ b/src/quick/util/qquickapplication.cpp
@@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE
\qml
Timer {
interval: 1000; repeat: true
- active: Application.state === Qt.Qt.ApplicationActive
+ active: Application.state === Qt.ApplicationActive
onTriggered: imageFetcher.fetchLatestImages()
}
\endqml
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
index 6fc50aaa5c..9bd2efb279 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -899,7 +899,9 @@ void QQuickDeliveryAgentPrivate::deliverKeyEvent(QKeyEvent *e)
e->isAutoRepeat(), e->count());
do {
- e->accept();
+ Q_ASSERT(e->type() != QEvent::ShortcutOverride || !e->isAccepted());
+ if (e->type() != QEvent::ShortcutOverride)
+ e->accept();
QCoreApplication::sendEvent(item, e);
} while (!e->isAccepted() && (item = item->parentItem()));
}
@@ -1055,6 +1057,7 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEvent(
if (subtreeHoverEnabled) {
hoveredLeafItemFound = false;
+ QQuickPointerHandlerPrivate::deviceDeliveryTargets(QPointingDevice::primaryPointingDevice()).clear();
deliverHoverEventRecursive(rootItem, scenePos, lastScenePos, modifiers, timestamp);
}
diff --git a/src/quick/util/qquickforeignutils.cpp b/src/quick/util/qquickforeignutils.cpp
index 34b3225abe..6ca5a42ade 100644
--- a/src/quick/util/qquickforeignutils.cpp
+++ b/src/quick/util/qquickforeignutils.cpp
@@ -19,32 +19,58 @@ QT_BEGIN_NAMESPACE
The following properties are available:
\list
- \li \l bool \c eventPoint.accepted: see also \l QEventPoint::accepted
- \li \l PointerDevice \c eventPoint.device: see also \l QEventPoint::device
- \li \l size \c eventPoint.ellipseDiameters: see also \l QEventPoint::ellipseDiameters
- \li \l point \c eventPoint.globalGrabPosition: see also \l QEventPoint::globalGrabPosition
- \li \l point \c eventPoint.globalLastPosition: see also \l QEventPoint::globalLastPosition
- \li \l point \c eventPoint.globalPosition: see also \l QEventPoint::globalPosition
- \li \l point \c eventPoint.globalPressPosition: see also \l QEventPoint::globalPressPosition
- \li \l bool \c eventPoint.grabPosition: see also \l QEventPoint::grabPosition
- \li \l int \c eventPoint.id: see also \l QEventPoint::id
- \li \l point \c eventPoint.lastPosition: see also \l QEventPoint::lastPosition
- \li \l ulong \c eventPoint.lastTimestamp: see also \l QEventPoint::lastTimestamp
- \li \l point \c eventPoint.position: see also \l QEventPoint::position
- \li \l point \c eventPoint.pressPosition: see also \l QEventPoint::pressPosition
- \li \l int \c eventPoint.pressTimestamp: see also \l QEventPoint::pressTimestamp
- \li \l real \c eventPoint.pressure: see also \l QEventPoint::pressure
- \li \l real \c eventPoint.rotation: see also \l QEventPoint::rotation
- \li \l point \c eventPoint.sceneGrabPosition: see also \l QEventPoint::sceneGrabPosition
- \li \l point \c eventPoint.sceneLastPosition: see also \l QEventPoint::sceneLastPosition
- \li \l point \c eventPoint.scenePosition: see also \l QEventPoint::scenePosition
- \li \l ulong \c eventPoint.pressTimestamp: see also \l QEventPoint::pressTimestamp
- \li \l point \c eventPoint.scenePressPosition: see also \l QEventPoint::scenePressPosition
- \li \l {QML Enumerations}{enumeration} \c eventPoint.state: see also \l QEventPoint::state
- \li \l real \c eventPoint.timeHeld: see also \l QEventPoint::timeHeld
- \li \l ulong \c eventPoint.timestamp: see also \l QEventPoint::timestamp
- \li \l pointingDeviceUniqueId \c eventPoint.uniqueId: see also \l QEventPoint::uniqueId
- \li \l vector2d \c eventPoint.velocity: see also \l QEventPoint::velocity
+ \li \l bool \c eventPoint.accepted \br
+ See also \l {QEventPoint::accepted}.
+ \li \l PointerDevice \c eventPoint.device \br
+ See also \l {QEventPoint::device}.
+ \li \l size \c eventPoint.ellipseDiameters \br
+ See also \l {QEventPoint::ellipseDiameters}.
+ \li \l point \c eventPoint.globalGrabPosition \br
+ See also \l {QEventPoint::globalGrabPosition}.
+ \li \l point \c eventPoint.globalLastPosition \br
+ See also \l {QEventPoint::globalLastPosition}.
+ \li \l point \c eventPoint.globalPosition \br
+ See also \l {QEventPoint::globalPosition}.
+ \li \l point \c eventPoint.globalPressPosition \br
+ See also \l {QEventPoint::globalPressPosition}.
+ \li \l bool \c eventPoint.grabPosition \br
+ See also \l {QEventPoint::grabPosition}.
+ \li \l int \c eventPoint.id \br
+ See also \l {QEventPoint::id}.
+ \li \l point \c eventPoint.lastPosition \br
+ See also \l {QEventPoint::lastPosition}.
+ \li \l ulong \c eventPoint.lastTimestamp \br
+ See also \l {QEventPoint::lastTimestamp}.
+ \li \l point \c eventPoint.position \br
+ See also \l {QEventPoint::position}.
+ \li \l point \c eventPoint.pressPosition \br
+ See also \l {QEventPoint::pressPosition}.
+ \li \l int \c eventPoint.pressTimestamp \br
+ See also \l {QEventPoint::pressTimestamp}.
+ \li \l real \c eventPoint.pressure \br
+ See also \l {QEventPoint::pressure}.
+ \li \l real \c eventPoint.rotation \br
+ See also \l {QEventPoint::rotation}.
+ \li \l point \c eventPoint.sceneGrabPosition \br
+ See also \l {QEventPoint::sceneGrabPosition}.
+ \li \l point \c eventPoint.sceneLastPosition \br
+ See also \l {QEventPoint::sceneLastPosition}.
+ \li \l point \c eventPoint.scenePosition \br
+ See also \l {QEventPoint::scenePosition}.
+ \li \l ulong \c eventPoint.pressTimestamp \br
+ See also \l {QEventPoint::pressTimestamp}.
+ \li \l point \c eventPoint.scenePressPosition \br
+ See also \l {QEventPoint::scenePressPosition}.
+ \li \l {QML Enumerations}{enumeration} \c eventPoint.state \br
+ See also \l {QEventPoint::state}.
+ \li \l real \c eventPoint.timeHeld \br
+ See also \l {QEventPoint::timeHeld}.
+ \li \l ulong \c eventPoint.timestamp \br
+ See also \l {QEventPoint::timestamp}.
+ \li \l pointingDeviceUniqueId \c eventPoint.uniqueId \br
+ See also \l {QEventPoint::uniqueId}.
+ \li \l vector2d \c eventPoint.velocity \br
+ See also \l {QEventPoint::velocity}.
\endlist
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 17529317d5..7562b74d46 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -1982,8 +1982,6 @@ void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data)
{
const QPointF &startPoint = path.currentPosition();
const QPointF &endPoint = positionForCurve(data, startPoint);
- if (startPoint == endPoint)
- return;
QQuickSvgParser::pathArc(path,
_radiusX,
_radiusY,
diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp
index 5f88805ef7..8cca5addbb 100644
--- a/src/quick/util/qquicksvgparser.cpp
+++ b/src/quick/util/qquicksvgparser.cpp
@@ -159,6 +159,10 @@ void QQuickSvgParser::pathArc(QPainterPath &path,
qreal y,
qreal curx, qreal cury)
{
+ // Check if the start point is equal to the end point.
+ if (QPointF(curx, cury) == QPointF(x, y))
+ return;
+
qreal sin_th, cos_th;
qreal a00, a01, a10, a11;
qreal x0, y0, x1, y1, xc, yc;
@@ -169,6 +173,14 @@ void QQuickSvgParser::pathArc(QPainterPath &path,
rx = qAbs(rx);
ry = qAbs(ry);
+ // Avoid nans and division by zero.
+ if (qFuzzyIsNull(rx) || qFuzzyIsNull(ry)) {
+ // https://www.w3.org/TR/SVG/paths.html#ArcOutOfRangeParameters says:
+ // "If either rx or ry is 0, then this arc is treated as a straight line
+ // segment (a "lineto") joining the endpoints."
+ path.lineTo(x, y);
+ return;
+ }
sin_th = qSin(qDegreesToRadians(x_axis_rotation));
cos_th = qCos(qDegreesToRadians(x_axis_rotation));
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index 09d92ddb36..3c5e847702 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -107,14 +107,20 @@ protected:
static qsizetype animation_count(QQmlListProperty<QQuickAbstractAnimation> *list);
static QQuickAbstractAnimation* animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos);
static void clear_animations(QQmlListProperty<QQuickAbstractAnimation> *list);
- QList<QQuickAbstractAnimation *> animations;
+ static void removeLast_animation(QQmlListProperty<QQuickAbstractAnimation> *list);
+ static void replace_animation(
+ QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos,
+ QQuickAbstractAnimation *a);
+
+ QList<QPointer<QQuickAbstractAnimation>> animations;
};
void QQuickTransitionPrivate::append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a)
{
QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
q->d_func()->animations.append(a);
- a->setDisableUserControl();
+ if (a)
+ a->setDisableUserControl();
}
qsizetype QQuickTransitionPrivate::animation_count(QQmlListProperty<QQuickAbstractAnimation> *list)
@@ -132,10 +138,25 @@ QQuickAbstractAnimation* QQuickTransitionPrivate::animation_at(QQmlListProperty<
void QQuickTransitionPrivate::clear_animations(QQmlListProperty<QQuickAbstractAnimation> *list)
{
QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
- while (q->d_func()->animations.size()) {
- QQuickAbstractAnimation *firstAnim = q->d_func()->animations.at(0);
- q->d_func()->animations.removeAll(firstAnim);
- }
+ q->d_func()->animations.clear();
+}
+
+void QQuickTransitionPrivate::removeLast_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
+{
+ QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
+ q->d_func()->animations.removeLast();
+}
+
+void QQuickTransitionPrivate::replace_animation(
+ QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos, QQuickAbstractAnimation *a)
+{
+ QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
+ QQuickTransitionPrivate *d = q->d_func();
+ if (d->animations.length() <= pos)
+ d->animations.resize(pos + 1, nullptr);
+ d->animations[pos] = a;
+ if (a)
+ a->setDisableUserControl();
}
void QQuickTransitionInstance::animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State)
@@ -240,15 +261,19 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action
int start = d->reversed ? d->animations.size() - 1 : 0;
int end = d->reversed ? -1 : d->animations.size();
- QAbstractAnimationJob *anim = nullptr;
- for (int i = start; i != end;) {
- anim = d->animations.at(i)->transition(actions, after, direction, defaultTarget);
- if (anim) {
- if (d->animations.at(i)->threadingModel() == QQuickAbstractAnimation::RenderThread)
- anim = new QQuickAnimatorProxyJob(anim, d->animations.at(i));
- d->reversed ? group->prependAnimation(anim) : group->appendAnimation(anim);
- }
- d->reversed ? --i : ++i;
+ for (int i = start; i != end; d->reversed ? --i : ++i) {
+ QQuickAbstractAnimation *anim = d->animations.at(i);
+ if (!anim)
+ continue;
+
+ QAbstractAnimationJob *job = anim->transition(actions, after, direction, defaultTarget);
+ if (!job)
+ continue;
+
+ if (anim->threadingModel() == QQuickAbstractAnimation::RenderThread)
+ job = new QQuickAnimatorProxyJob(job, anim);
+
+ d->reversed ? group->prependAnimation(job) : group->appendAnimation(job);
}
group->setDirection(d->reversed ? QAbstractAnimationJob::Backward : QAbstractAnimationJob::Forward);
@@ -434,10 +459,14 @@ bool QQuickTransition::running() const
QQmlListProperty<QQuickAbstractAnimation> QQuickTransition::animations()
{
Q_D(QQuickTransition);
- return QQmlListProperty<QQuickAbstractAnimation>(this, &d->animations, QQuickTransitionPrivate::append_animation,
- QQuickTransitionPrivate::animation_count,
- QQuickTransitionPrivate::animation_at,
- QQuickTransitionPrivate::clear_animations);
+ return QQmlListProperty<QQuickAbstractAnimation>(
+ this, &d->animations,
+ QQuickTransitionPrivate::append_animation,
+ QQuickTransitionPrivate::animation_count,
+ QQuickTransitionPrivate::animation_at,
+ QQuickTransitionPrivate::clear_animations,
+ QQuickTransitionPrivate::replace_animation,
+ QQuickTransitionPrivate::removeLast_animation);
}
QT_END_NAMESPACE