gestures: rename weirdly named methods

This commit is contained in:
Xaver Hugl 2022-05-18 16:54:17 +02:00
parent 103d6b9e92
commit 2238e608d6
2 changed files with 8 additions and 8 deletions

View file

@ -41,7 +41,7 @@ void SwipeGesture::setStartGeometry(const QRect &geometry)
Q_ASSERT(m_maximumY >= m_minimumY);
}
qreal SwipeGesture::minimumDeltaReachedProgress(const QSizeF &delta) const
qreal SwipeGesture::deltaToProgress(const QSizeF &delta) const
{
if (!m_minimumDeltaRelevant || m_minimumDelta.isNull()) {
return 1.0;
@ -61,7 +61,7 @@ qreal SwipeGesture::minimumDeltaReachedProgress(const QSizeF &delta) const
bool SwipeGesture::minimumDeltaReached(const QSizeF &delta) const
{
return minimumDeltaReachedProgress(delta) >= 1.0;
return deltaToProgress(delta) >= 1.0;
}
PinchGesture::PinchGesture(QObject *parent)
@ -71,14 +71,14 @@ PinchGesture::PinchGesture(QObject *parent)
PinchGesture::~PinchGesture() = default;
qreal PinchGesture::minimumScaleDeltaReachedProgress(const qreal &scaleDelta) const
qreal PinchGesture::scaleDeltaToProgress(const qreal &scaleDelta) const
{
return std::abs(scaleDelta - 1) / minimumScaleDelta();
}
bool PinchGesture::minimumScaleDeltaReached(const qreal &scaleDelta) const
{
return minimumScaleDeltaReachedProgress(scaleDelta) >= 1.0;
return scaleDeltaToProgress(scaleDelta) >= 1.0;
}
GestureRecognizer::GestureRecognizer(QObject *parent)
@ -256,7 +256,7 @@ void GestureRecognizer::updateSwipeGesture(const QSizeF &delta)
// Send progress update
for (SwipeGesture *g : std::as_const(m_activeSwipeGestures)) {
Q_EMIT g->progress(g->minimumDeltaReachedProgress(m_currentDelta));
Q_EMIT g->progress(g->deltaToProgress(m_currentDelta));
Q_EMIT g->deltaProgress(m_currentDelta);
}
}
@ -360,7 +360,7 @@ void GestureRecognizer::updatePinchGesture(qreal scale, qreal angleDelta, const
}
for (PinchGesture *g : std::as_const(m_activePinchGestures)) {
Q_EMIT g->progress(g->minimumScaleDeltaReachedProgress(scale));
Q_EMIT g->progress(g->scaleDeltaToProgress(scale));
}
}

View file

@ -95,7 +95,7 @@ public:
void setMinimumDelta(const QSizeF &delta);
bool isMinimumDeltaRelevant() const;
qreal minimumDeltaReachedProgress(const QSizeF &delta) const;
qreal deltaToProgress(const QSizeF &delta) const;
bool minimumDeltaReached(const QSizeF &delta) const;
Q_SIGNALS:
@ -160,7 +160,7 @@ public:
void setMinimumScaleDelta(const qreal &scaleDelta);
bool isMinimumScaleDeltaRelevant() const;
qreal minimumScaleDeltaReachedProgress(const qreal &scaleDelta) const;
qreal scaleDeltaToProgress(const qreal &scaleDelta) const;
bool minimumScaleDeltaReached(const qreal &scaleDelta) const;
Q_SIGNALS: