Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQuickVector2DValueType Class Reference

#include <qquickvaluetypes_p.h>

Inheritance diagram for QQuickVector2DValueType:
Collaboration diagram for QQuickVector2DValueType:

Public Member Functions

Q_INVOKABLE QQuickVector2DValueType ()=default
Q_INVOKABLE QQuickVector2DValueType (const QVector2D &vector2D)
Q_INVOKABLE QString toString () const
qreal x () const
qreal y () const
void setX (qreal)
void setY (qreal)
Q_INVOKABLE qreal dotProduct (const QVector2D &vec) const
Q_INVOKABLE QVector2D times (const QVector2D &vec) const
Q_INVOKABLE QVector2D times (qreal scalar) const
Q_INVOKABLE QVector2D plus (const QVector2D &vec) const
Q_INVOKABLE QVector2D minus (const QVector2D &vec) const
Q_INVOKABLE QVector2D normalized () const
Q_INVOKABLE qreal length () const
Q_INVOKABLE QVector3D toVector3d () const
Q_INVOKABLE QVector4D toVector4d () const
Q_INVOKABLE bool fuzzyEquals (const QVector2D &vec, qreal epsilon) const
Q_INVOKABLE bool fuzzyEquals (const QVector2D &vec) const
Public Member Functions inherited from QVector2D
constexpr QVector2D () noexcept
 Constructs a null vector, i.e.
 QVector2D (Qt::Initialization) noexcept
constexpr QVector2D (float xpos, float ypos) noexcept
 Constructs a vector with coordinates (xpos, ypos).
constexpr QVector2D (QPoint point) noexcept
 Constructs a vector with x and y coordinates from a 2D point.
constexpr QVector2D (QPointF point) noexcept
 Constructs a vector with x and y coordinates from a 2D point.
constexpr QVector2D (QVector3D vector) noexcept
 Constructs a vector with x and y coordinates from a 3D vector.
constexpr QVector2D (QVector4D vector) noexcept
 Constructs a vector with x and y coordinates from a 3D vector.
constexpr bool isNull () const noexcept
 Returns true if the x and y coordinates are set to 0.0, otherwise returns false.
constexpr float x () const noexcept
 Returns the x coordinate of this point.
constexpr float y () const noexcept
 Returns the y coordinate of this point.
constexpr void setX (float x) noexcept
 Sets the x coordinate of this point to the given finite x coordinate.
constexpr void setY (float y) noexcept
 Sets the y coordinate of this point to the given finite y coordinate.
constexpr float & operator[] (int i)
constexpr float operator[] (int i) const
float length () const noexcept
 Returns the length of the vector from the origin.
constexpr float lengthSquared () const noexcept
 Returns the squared length of the vector from the origin.
QVector2D normalized () const noexcept
 Returns the normalized unit vector form of this vector.
void normalize () noexcept
 Normalizes the current vector in place.
float distanceToPoint (QVector2D point) const noexcept
float distanceToLine (QVector2D point, QVector2D direction) const noexcept
constexpr QVector2Doperator+= (QVector2D vector) noexcept
 Adds the given vector to this vector and returns a reference to this vector.
constexpr QVector2Doperator-= (QVector2D vector) noexcept
 Subtracts the given vector from this vector and returns a reference to this vector.
constexpr QVector2Doperator*= (float factor) noexcept
 Multiplies this vector's coordinates by the given finite factor and returns a reference to this vector.
constexpr QVector2Doperator*= (QVector2D vector) noexcept
 Multiplies each component of this vector by the corresponding component of vector and returns a reference to this vector.
constexpr QVector2Doperator/= (float divisor)
 Divides this vector's coordinates by the given divisor and returns a reference to this vector.
constexpr QVector2Doperator/= (QVector2D vector)
constexpr QVector3D toVector3D () const noexcept
 Returns the 3D form of this 2D vector, with the z coordinate set to zero.
constexpr QVector4D toVector4D () const noexcept
 Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.
constexpr QPoint toPoint () const noexcept
 Returns the QPoint form of this 2D vector.
constexpr QPointF toPointF () const noexcept
 Returns the QPointF form of this 2D vector.
Q_GUI_EXPORT operator QVariant () const
 Returns the 2D vector as a QVariant.

Static Public Member Functions

static QVariant create (const QJSValue &params)
Static Public Member Functions inherited from QVector2D
static constexpr float dotProduct (QVector2D v1, QVector2D v2) noexcept
 Returns the dot product of v1 and v2.

Properties

qreal x
qreal y

Additional Inherited Members

Detailed Description

Definition at line 90 of file qquickvaluetypes_p.h.

Constructor & Destructor Documentation

◆ QQuickVector2DValueType() [1/2]

Q_INVOKABLE QQuickVector2DValueType::QQuickVector2DValueType ( )
default

◆ QQuickVector2DValueType() [2/2]

Q_INVOKABLE QQuickVector2DValueType::QQuickVector2DValueType ( const QVector2D & vector2D)
inline

Definition at line 105 of file qquickvaluetypes_p.h.

Member Function Documentation

◆ create()

QVariant QQuickVector2DValueType::create ( const QJSValue & params)
static

Definition at line 184 of file qquickvaluetypes.cpp.

◆ dotProduct()

qreal QQuickVector2DValueType::dotProduct ( const QVector2D & vec) const

Definition at line 218 of file qquickvaluetypes.cpp.

◆ fuzzyEquals() [1/2]

bool QQuickVector2DValueType::fuzzyEquals ( const QVector2D & vec) const

Definition at line 273 of file qquickvaluetypes.cpp.

◆ fuzzyEquals() [2/2]

bool QQuickVector2DValueType::fuzzyEquals ( const QVector2D & vec,
qreal epsilon ) const

Definition at line 263 of file qquickvaluetypes.cpp.

◆ length()

qreal QQuickVector2DValueType::length ( ) const

Definition at line 248 of file qquickvaluetypes.cpp.

◆ minus()

QVector2D QQuickVector2DValueType::minus ( const QVector2D & vec) const

Definition at line 238 of file qquickvaluetypes.cpp.

◆ normalized()

QVector2D QQuickVector2DValueType::normalized ( ) const

Definition at line 243 of file qquickvaluetypes.cpp.

◆ plus()

QVector2D QQuickVector2DValueType::plus ( const QVector2D & vec) const

Definition at line 233 of file qquickvaluetypes.cpp.

◆ setX()

void QQuickVector2DValueType::setX ( qreal x)

Definition at line 208 of file qquickvaluetypes.cpp.

◆ setY()

void QQuickVector2DValueType::setY ( qreal y)

Definition at line 213 of file qquickvaluetypes.cpp.

◆ times() [1/2]

QVector2D QQuickVector2DValueType::times ( const QVector2D & vec) const

Definition at line 223 of file qquickvaluetypes.cpp.

◆ times() [2/2]

QVector2D QQuickVector2DValueType::times ( qreal scalar) const

Definition at line 228 of file qquickvaluetypes.cpp.

◆ toString()

QString QQuickVector2DValueType::toString ( ) const

Definition at line 193 of file qquickvaluetypes.cpp.

◆ toVector3d()

QVector3D QQuickVector2DValueType::toVector3d ( ) const

Definition at line 253 of file qquickvaluetypes.cpp.

◆ toVector4d()

QVector4D QQuickVector2DValueType::toVector4d ( ) const

Definition at line 258 of file qquickvaluetypes.cpp.

◆ x()

qreal QQuickVector2DValueType::x ( ) const

Definition at line 198 of file qquickvaluetypes.cpp.

◆ y()

qreal QQuickVector2DValueType::y ( ) const

Definition at line 203 of file qquickvaluetypes.cpp.

Property Documentation

◆ x

qreal QQuickVector2DValueType::x
readwrite

Definition at line 92 of file qquickvaluetypes_p.h.

◆ y

qreal QQuickVector2DValueType::y
readwrite

Definition at line 93 of file qquickvaluetypes_p.h.


The documentation for this class was generated from the following files: