{QTouchEvent,QWindowSystemInterface}::TouchPoint: replace QList<QPointF> with QVector
QPointF is in the category of types for which QList is needlessly inefficient (elements are copy-constructed onto the heap and held through pointers). Use a vector instead. This is consistent with the QPainter API. Change-Id: Ie3d6647e05b40a33a7bb0598cbbcde4676e00836 Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
73a5ce5195
commit
86abc87883
@ -3863,10 +3863,11 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.0
|
||||
Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
|
||||
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
|
||||
|
||||
\note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
|
||||
\note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.
|
||||
|
||||
\note Native screen coordinates refer to the native orientation of the screen which, in case of
|
||||
mobile devices, is typically portrait. This means that on systems capable of screen orientation
|
||||
@ -3875,7 +3876,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
|
||||
|
||||
\sa QTouchDevice::capabilities(), device(), window()
|
||||
*/
|
||||
QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
|
||||
QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
|
||||
{
|
||||
return d->rawScreenPositions;
|
||||
}
|
||||
@ -4033,7 +4034,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions)
|
||||
void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
d = d->detach();
|
||||
|
@ -753,7 +753,7 @@ public:
|
||||
qreal pressure() const;
|
||||
QVector2D velocity() const;
|
||||
InfoFlags flags() const;
|
||||
QList<QPointF> rawScreenPositions() const;
|
||||
QVector<QPointF> rawScreenPositions() const;
|
||||
|
||||
// internal
|
||||
void setId(int id);
|
||||
@ -776,7 +776,7 @@ public:
|
||||
void setPressure(qreal pressure);
|
||||
void setVelocity(const QVector2D &v);
|
||||
void setFlags(InfoFlags flags);
|
||||
void setRawScreenPositions(const QList<QPointF> &positions);
|
||||
void setRawScreenPositions(const QVector<QPointF> &positions);
|
||||
|
||||
private:
|
||||
QTouchEventTouchPointPrivate *d;
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
qreal pressure;
|
||||
QVector2D velocity;
|
||||
QTouchEvent::TouchPoint::InfoFlags flags;
|
||||
QList<QPointF> rawScreenPositions;
|
||||
QVector<QPointF> rawScreenPositions;
|
||||
};
|
||||
|
||||
class QFileOpenEventPrivate
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
|
||||
QVector2D velocity; // in screen coordinate system, pixels / seconds
|
||||
QTouchEvent::TouchPoint::InfoFlags flags;
|
||||
QList<QPointF> rawPositions; // in screen coordinates
|
||||
QVector<QPointF> rawPositions; // in screen coordinates
|
||||
};
|
||||
|
||||
static void registerTouchDevice(QTouchDevice *device);
|
||||
|
@ -595,7 +595,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
|
||||
rawTouchPoint.setState(Qt::TouchPointPressed);
|
||||
rawTouchPoint.setScreenPos(screenPos);
|
||||
rawTouchPoint.setNormalizedPos(normalized(rawTouchPoint.pos(), screenGeometry));
|
||||
QList<QPointF> rawPosList;
|
||||
QVector<QPointF> rawPosList;
|
||||
rawPosList << QPointF(12, 34) << QPointF(56, 78);
|
||||
rawTouchPoint.setRawScreenPositions(rawPosList);
|
||||
const ulong timestamp = 1234;
|
||||
|
Loading…
Reference in New Issue
Block a user