Struct qt_gui::QPolygonF

source ·
#[repr(C)]
pub struct QPolygonF { /* private fields */ }
Expand description

The QPolygonF class provides a vector of points using floating point precision.

C++ class: QPolygonF.

C++ documentation:

The QPolygonF class provides a vector of points using floating point precision.

A QPolygonF is a QVector<QPointF>. The easiest way to add points to a QPolygonF is to use its streaming operator, as illustrated below:

QPolygonF polygon; polygon << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);

In addition to the functions provided by QVector, QPolygonF provides the boundingRect() and translate() functions for geometry operations. Use the QMatrix::map() function for more general transformations of QPolygonFs.

QPolygonF also provides the isClosed() function to determine whether a polygon's start and end points are the same, and the toPolygon() function returning an integer precision copy of this polygon.

The QPolygonF class is implicitly shared.

Implementations§

source§

impl QPolygonF

source

pub unsafe fn bounding_rect(&self) -> CppBox<QRectF>

Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.

Calls C++ function: QRectF QPolygonF::boundingRect() const.

C++ documentation:

Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty.

See also QVector::isEmpty().

source

pub unsafe fn contains_point( &self, pt: impl CastInto<Ref<QPointF>>, fill_rule: FillRule ) -> bool

Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false.

Calls C++ function: bool QPolygonF::containsPoint(const QPointF& pt, Qt::FillRule fillRule) const.

C++ documentation:

Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false.

This function was introduced in Qt 4.3.

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QPolygonF>> ) -> Ref<QPolygonF>

Copy-assignment operator.

Calls C++ function: QPolygonF& QPolygonF::operator=(const QPolygonF& other).

C++ documentation:

Copy-assignment operator.

source

pub unsafe fn intersected( &self, r: impl CastInto<Ref<QPolygonF>> ) -> CppBox<QPolygonF>

Returns a polygon which is the intersection of this polygon and r.

Calls C++ function: QPolygonF QPolygonF::intersected(const QPolygonF& r) const.

C++ documentation:

Returns a polygon which is the intersection of this polygon and r.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

source

pub unsafe fn intersects(&self, r: impl CastInto<Ref<QPolygonF>>) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if the current polygon intersects at any point the given polygon p. Also returns true if the current polygon contains or is contained by any part of p.

Calls C++ function: bool QPolygonF::intersects(const QPolygonF& r) const.

C++ documentation:

Returns true if the current polygon intersects at any point the given polygon p. Also returns true if the current polygon contains or is contained by any part of p.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 5.10.

See also intersected().

source

pub unsafe fn is_closed(&self) -> bool

Returns true if the polygon is closed; otherwise returns false.

Calls C++ function: bool QPolygonF::isClosed() const.

C++ documentation:

Returns true if the polygon is closed; otherwise returns false.

A polygon is said to be closed if its start point and end point are equal.

See also QVector::first() and QVector::last().

source

pub unsafe fn new() -> CppBox<QPolygonF>

Constructs a polygon with no points.

Calls C++ function: [constructor] void QPolygonF::QPolygonF().

C++ documentation:

Constructs a polygon with no points.

See also QVector::isEmpty().

source

pub unsafe fn from_int(size: c_int) -> CppBox<QPolygonF>

Constructs a polygon of the given size. Creates an empty polygon if size == 0.

Calls C++ function: [constructor] void QPolygonF::QPolygonF(int size).

C++ documentation:

Constructs a polygon of the given size. Creates an empty polygon if size == 0.

See also QVector::isEmpty().

source

pub unsafe fn from_q_vector_of_q_point_f( v: impl CastInto<Ref<QVectorOfQPointF>> ) -> CppBox<QPolygonF>

Constructs a polygon containing the specified points.

Calls C++ function: [constructor] void QPolygonF::QPolygonF(const QVector<QPointF>& v).

C++ documentation:

Constructs a polygon containing the specified points.

source

pub unsafe fn from_q_rect_f(r: impl CastInto<Ref<QRectF>>) -> CppBox<QPolygonF>

Constructs a closed polygon from the specified rectangle.

Calls C++ function: [constructor] void QPolygonF::QPolygonF(const QRectF& r).

C++ documentation:

Constructs a closed polygon from the specified rectangle.

The polygon contains the four vertices of the rectangle in clockwise order starting and ending with the top-left vertex.

See also isClosed().

source

pub unsafe fn from_q_polygon( a: impl CastInto<Ref<QPolygon>> ) -> CppBox<QPolygonF>

Constructs a float based polygon from the specified integer based polygon.

Calls C++ function: [constructor] void QPolygonF::QPolygonF(const QPolygon& a).

C++ documentation:

Constructs a float based polygon from the specified integer based polygon.

See also toPolygon().

source

pub unsafe fn new_copy(a: impl CastInto<Ref<QPolygonF>>) -> CppBox<QPolygonF>

Constructs a copy of the given polygon.

Calls C++ function: [constructor] void QPolygonF::QPolygonF(const QPolygonF& a).

C++ documentation:

Constructs a copy of the given polygon.

source

pub unsafe fn subtracted( &self, r: impl CastInto<Ref<QPolygonF>> ) -> CppBox<QPolygonF>

Returns a polygon which is r subtracted from this polygon.

Calls C++ function: QPolygonF QPolygonF::subtracted(const QPolygonF& r) const.

C++ documentation:

Returns a polygon which is r subtracted from this polygon.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QPolygonF>>)

Swaps polygon other with this polygon. This operation is very fast and never fails.

Calls C++ function: void QPolygonF::swap(QPolygonF& other).

C++ documentation:

Swaps polygon other with this polygon. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

source

pub unsafe fn to_polygon(&self) -> CppBox<QPolygon>

Creates and returns a QPolygon by converting each QPointF to a QPoint.

Calls C++ function: QPolygon QPolygonF::toPolygon() const.

C++ documentation:

Creates and returns a QPolygon by converting each QPointF to a QPoint.

See also QPointF::toPoint().

source

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>

Returns the polygon as a QVariant.

Calls C++ function: QVariant QPolygonF::operator QVariant() const.

C++ documentation:

Returns the polygon as a QVariant.

source

pub unsafe fn translate_2a(&self, dx: c_double, dy: c_double)

This is an overloaded function.

Calls C++ function: void QPolygonF::translate(double dx, double dy).

C++ documentation:

This is an overloaded function.

Translates all points in the polygon by (dx, dy).

See also translated().

source

pub unsafe fn translate_1a(&self, offset: impl CastInto<Ref<QPointF>>)

Translate all points in the polygon by the given offset.

Calls C++ function: void QPolygonF::translate(const QPointF& offset).

C++ documentation:

Translate all points in the polygon by the given offset.

See also translated().

source

pub unsafe fn translated_2a( &self, dx: c_double, dy: c_double ) -> CppBox<QPolygonF>

This is an overloaded function.

Calls C++ function: QPolygonF QPolygonF::translated(double dx, double dy) const.

C++ documentation:

This is an overloaded function.

Returns a copy of the polygon that is translated by (dx, dy).

This function was introduced in Qt 4.6.

See also translate().

source

pub unsafe fn translated_1a( &self, offset: impl CastInto<Ref<QPointF>> ) -> CppBox<QPolygonF>

Returns a copy of the polygon that is translated by the given offset.

Calls C++ function: QPolygonF QPolygonF::translated(const QPointF& offset) const.

C++ documentation:

Returns a copy of the polygon that is translated by the given offset.

This function was introduced in Qt 4.6.

See also translate().

source

pub unsafe fn united( &self, r: impl CastInto<Ref<QPolygonF>> ) -> CppBox<QPolygonF>

Returns a polygon which is the union of this polygon and r.

Calls C++ function: QPolygonF QPolygonF::united(const QPolygonF& r) const.

C++ documentation:

Returns a polygon which is the union of this polygon and r.

Set operations on polygons will treat the polygons as areas. Non-closed polygons will be treated as implicitly closed.

This function was introduced in Qt 4.3.

See also intersected() and subtracted().

Methods from Deref<Target = QVectorOfQPointF>§

source

pub unsafe fn add_assign_q_vector_of_q_point_f( &self, l: impl CastInto<Ref<QVectorOfQPointF>> ) -> Ref<QVectorOfQPointF>

Appends the items of the other vector to this vector and returns a reference to this vector.

Calls C++ function: QVector<QPointF>& QVector<QPointF>::operator+=(const QVector<QPointF>& l).

C++ documentation:

Appends the items of the other vector to this vector and returns a reference to this vector.

See also operator+() and append().

source

pub unsafe fn add_assign_q_point_f( &self, t: impl CastInto<Ref<QPointF>> ) -> Ref<QVectorOfQPointF>

This is an overloaded function.

Calls C++ function: QVector<QPointF>& QVector<QPointF>::operator+=(const QPointF& t).

C++ documentation:

This is an overloaded function.

Appends value to the vector.

See also append() and operator<<().

source

pub unsafe fn append_q_point_f(&self, t: impl CastInto<Ref<QPointF>>)

Inserts value at the end of the vector.

Calls C++ function: void QVector<QPointF>::append(const QPointF& t).

C++ documentation:

Inserts value at the end of the vector.

Example:

QVector<QString> vector; vector.append(“one”); vector.append(“two”); QString three = “three”; vector.append(three); // vector: [“one”, “two”, “three”] // three: “three”

This is the same as calling resize(size() + 1) and assigning value to the new last element in the vector.

This operation is relatively fast, because QVector typically allocates more memory than necessary, so it can grow without reallocating the entire vector each time.

See also operator<<(), prepend(), and insert().

source

pub unsafe fn append_q_vector_of_q_point_f( &self, l: impl CastInto<Ref<QVectorOfQPointF>> )

This is an overloaded function.

Calls C++ function: void QVector<QPointF>::append(const QVector<QPointF>& l).

C++ documentation:

This is an overloaded function.

Appends the items of the value vector to this vector.

This function was introduced in Qt 5.5.

See also operator<<() and operator+=().

source

pub unsafe fn at(&self, i: i32) -> Ref<QPointF>

Returns the item at index position i in the vector.

Calls C++ function: const QPointF& QVector<QPointF>::at(int i) const.

C++ documentation:

Returns the item at index position i in the vector.

i must be a valid index position in the vector (i.e., 0 <= i < size()).

See also value() and operator[]().

source

pub unsafe fn back_mut(&self) -> Ref<QPointF>

This function is provided for STL compatibility. It is equivalent to last().

Calls C++ function: QPointF& QVector<QPointF>::back().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to last().

source

pub unsafe fn back(&self) -> Ref<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF& QVector<QPointF>::back() const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn capacity(&self) -> i32

Returns the maximum number of items that can be stored in the vector without forcing a reallocation.

Calls C++ function: int QVector<QPointF>::capacity() const.

C++ documentation:

Returns the maximum number of items that can be stored in the vector without forcing a reallocation.

The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function. If you want to know how many items are in the vector, call size().

See also reserve() and squeeze().

source

pub unsafe fn clear(&self)

Removes all the elements from the vector.

Calls C++ function: void QVector<QPointF>::clear().

C++ documentation:

Removes all the elements from the vector.

Note: Until Qt 5.6, this also released the memory used by the vector. From Qt 5.7, the capacity is preserved. To shed all capacity, swap with a default-constructed vector:

QVector<T> v ...; QVector<T>().swap(v); Q_ASSERT(v.capacity() == 0);

or call squeeze().

See also squeeze().

source

pub unsafe fn const_data(&self) -> Ptr<QPointF>

Returns a const pointer to the data stored in the vector. The pointer can be used to access the items in the vector. The pointer remains valid as long as the vector isn't reallocated.

Calls C++ function: const QPointF* QVector<QPointF>::constData() const.

C++ documentation:

Returns a const pointer to the data stored in the vector. The pointer can be used to access the items in the vector. The pointer remains valid as long as the vector isn’t reallocated.

This function is mostly useful to pass a vector to a function that accepts a plain C++ array.

See also data() and operator[]().

source

pub unsafe fn const_first(&self) -> Ref<QPointF>

Returns a const reference to the first item in the vector. This function assumes that the vector isn't empty.

Calls C++ function: const QPointF& QVector<QPointF>::constFirst() const.

C++ documentation:

Returns a const reference to the first item in the vector. This function assumes that the vector isn’t empty.

This function was introduced in Qt 5.6.

See also constLast(), isEmpty(), and first().

source

pub unsafe fn const_last(&self) -> Ref<QPointF>

Returns a const reference to the last item in the vector. This function assumes that the vector isn't empty.

Calls C++ function: const QPointF& QVector<QPointF>::constLast() const.

C++ documentation:

Returns a const reference to the last item in the vector. This function assumes that the vector isn’t empty.

This function was introduced in Qt 5.6.

See also constFirst(), isEmpty(), and last().

source

pub unsafe fn contains(&self, t: impl CastInto<Ref<QPointF>>) -> bool

Returns true if the vector contains an occurrence of value; otherwise returns false.

Calls C++ function: bool QVector<QPointF>::contains(const QPointF& t) const.

C++ documentation:

Returns true if the vector contains an occurrence of value; otherwise returns false.

This function requires the value type to have an implementation of operator==().

See also indexOf() and count().

source

pub unsafe fn copy_from( &self, v: impl CastInto<Ref<QVectorOfQPointF>> ) -> Ref<QVectorOfQPointF>

Assigns other to this vector and returns a reference to this vector.

Calls C++ function: QVector<QPointF>& QVector<QPointF>::operator=(const QVector<QPointF>& v).

C++ documentation:

Assigns other to this vector and returns a reference to this vector.

source

pub unsafe fn count_1a(&self, t: impl CastInto<Ref<QPointF>>) -> i32

Returns the number of occurrences of value in the vector.

Calls C++ function: int QVector<QPointF>::count(const QPointF& t) const.

C++ documentation:

Returns the number of occurrences of value in the vector.

This function requires the value type to have an implementation of operator==().

See also contains() and indexOf().

source

pub unsafe fn count_0a(&self) -> i32

This is an overloaded function.

Calls C++ function: int QVector<QPointF>::count() const.

C++ documentation:

This is an overloaded function.

Same as size().

source

pub unsafe fn data_mut(&self) -> Ptr<QPointF>

Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.

Calls C++ function: QPointF* QVector<QPointF>::data().

C++ documentation:

Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.

Example:

QVector<int> vector(10); int data = vector.data(); for (int i = 0; i < 10; ++i) data[i] = 2 i;

The pointer remains valid as long as the vector isn't reallocated.

This function is mostly useful to pass a vector to a function that accepts a plain C++ array.

See also constData() and operator[]().

source

pub unsafe fn data(&self) -> Ptr<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF* QVector<QPointF>::data() const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn detach(&self)

Calls C++ function: void QVector<QPointF>::detach().

source

pub unsafe fn empty(&self) -> bool

This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the vector is empty; otherwise returns false.

Calls C++ function: bool QVector<QPointF>::empty() const.

C++ documentation:

This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the vector is empty; otherwise returns false.

source

pub unsafe fn ends_with(&self, t: impl CastInto<Ref<QPointF>>) -> bool

Returns true if this vector is not empty and its last item is equal to value; otherwise returns false.

Calls C++ function: bool QVector<QPointF>::endsWith(const QPointF& t) const.

C++ documentation:

Returns true if this vector is not empty and its last item is equal to value; otherwise returns false.

This function was introduced in Qt 4.5.

See also isEmpty() and last().

source

pub unsafe fn fill_2a( &self, t: impl CastInto<Ref<QPointF>>, size: i32 ) -> Ref<QVectorOfQPointF>

Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.

Calls C++ function: QVector<QPointF>& QVector<QPointF>::fill(const QPointF& t, int size = …).

C++ documentation:

Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.

Example:

QVector<QString> vector(3); vector.fill(“Yes”); // vector: [“Yes”, “Yes”, “Yes”]

vector.fill(“oh”, 5); // vector: [“oh”, “oh”, “oh”, “oh”, “oh”]

See also resize().

source

pub unsafe fn fill_1a( &self, t: impl CastInto<Ref<QPointF>> ) -> Ref<QVectorOfQPointF>

Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.

Calls C++ function: QVector<QPointF>& QVector<QPointF>::fill(const QPointF& t).

C++ documentation:

Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.

Example:

QVector<QString> vector(3); vector.fill(“Yes”); // vector: [“Yes”, “Yes”, “Yes”]

vector.fill(“oh”, 5); // vector: [“oh”, “oh”, “oh”, “oh”, “oh”]

See also resize().

source

pub unsafe fn first_mut(&self) -> Ref<QPointF>

Returns a reference to the first item in the vector. This function assumes that the vector isn't empty.

Calls C++ function: QPointF& QVector<QPointF>::first().

C++ documentation:

Returns a reference to the first item in the vector. This function assumes that the vector isn’t empty.

See also last(), isEmpty(), and constFirst().

source

pub unsafe fn first(&self) -> Ref<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF& QVector<QPointF>::first() const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn front_mut(&self) -> Ref<QPointF>

This function is provided for STL compatibility. It is equivalent to first().

Calls C++ function: QPointF& QVector<QPointF>::front().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to first().

source

pub unsafe fn front(&self) -> Ref<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF& QVector<QPointF>::front() const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn index_mut(&self, i: i32) -> Ref<QPointF>

Returns the item at index position i as a modifiable reference.

Calls C++ function: QPointF& QVector<QPointF>::operator[](int i).

C++ documentation:

Returns the item at index position i as a modifiable reference.

i must be a valid index position in the vector (i.e., 0 <= i < size()).

Note that using non-const operators can cause QVector to do a deep copy.

See also at() and value().

source

pub unsafe fn index(&self, i: i32) -> Ref<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF& QVector<QPointF>::operator[](int i) const.

C++ documentation:

This is an overloaded function.

Same as at(i).

source

pub unsafe fn index_of_2a( &self, t: impl CastInto<Ref<QPointF>>, from: i32 ) -> i32

Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.

Calls C++ function: int QVector<QPointF>::indexOf(const QPointF& t, int from = …) const.

C++ documentation:

Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.

Example:

QVector<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.indexOf(“B”); // returns 1 vector.indexOf(“B”, 1); // returns 1 vector.indexOf(“B”, 2); // returns 3 vector.indexOf(“X”); // returns -1

This function requires the value type to have an implementation of operator==().

See also lastIndexOf() and contains().

source

pub unsafe fn index_of_1a(&self, t: impl CastInto<Ref<QPointF>>) -> i32

Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.

Calls C++ function: int QVector<QPointF>::indexOf(const QPointF& t) const.

C++ documentation:

Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.

Example:

QVector<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.indexOf(“B”); // returns 1 vector.indexOf(“B”, 1); // returns 1 vector.indexOf(“B”, 2); // returns 3 vector.indexOf(“X”); // returns -1

This function requires the value type to have an implementation of operator==().

See also lastIndexOf() and contains().

source

pub unsafe fn insert_2a(&self, i: i32, t: impl CastInto<Ref<QPointF>>)

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Calls C++ function: void QVector<QPointF>::insert(int i, const QPointF& t).

C++ documentation:

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Example:

QVector<QString> vector; vector << “alpha” << “beta” << “delta”; vector.insert(2, “gamma”); // vector: [“alpha”, “beta”, “gamma”, “delta”]

For large vectors, this operation can be slow (linear time), because it requires moving all the items at indexes i and above by one position further in memory. If you want a container class that provides a fast insert() function, use QLinkedList instead.

See also append(), prepend(), and remove().

source

pub unsafe fn insert_3a(&self, i: i32, n: i32, t: impl CastInto<Ref<QPointF>>)

This is an overloaded function.

Calls C++ function: void QVector<QPointF>::insert(int i, int n, const QPointF& t).

C++ documentation:

This is an overloaded function.

Inserts count copies of value at index position i in the vector.

Example:

QVector<double> vector; vector << 2.718 << 1.442 << 0.4342; vector.insert(1, 3, 9.9); // vector: [2.718, 9.9, 9.9, 9.9, 1.442, 0.4342]

source

pub unsafe fn is_detached(&self) -> bool

Calls C++ function: bool QVector<QPointF>::isDetached() const.

source

pub unsafe fn is_empty(&self) -> bool

Returns true if the vector has size 0; otherwise returns false.

Calls C++ function: bool QVector<QPointF>::isEmpty() const.

C++ documentation:

Returns true if the vector has size 0; otherwise returns false.

See also size() and resize().

source

pub unsafe fn is_shared_with( &self, other: impl CastInto<Ref<QVectorOfQPointF>> ) -> bool

Calls C++ function: bool QVector<QPointF>::isSharedWith(const QVector<QPointF>& other) const.

source

pub unsafe fn last_mut(&self) -> Ref<QPointF>

Returns a reference to the last item in the vector. This function assumes that the vector isn't empty.

Calls C++ function: QPointF& QVector<QPointF>::last().

C++ documentation:

Returns a reference to the last item in the vector. This function assumes that the vector isn’t empty.

See also first(), isEmpty(), and constLast().

source

pub unsafe fn last(&self) -> Ref<QPointF>

This is an overloaded function.

Calls C++ function: const QPointF& QVector<QPointF>::last() const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn last_index_of_2a( &self, t: impl CastInto<Ref<QPointF>>, from: i32 ) -> i32

Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.

Calls C++ function: int QVector<QPointF>::lastIndexOf(const QPointF& t, int from = …) const.

C++ documentation:

Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.

Example:

QList<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.lastIndexOf(“B”); // returns 3 vector.lastIndexOf(“B”, 3); // returns 3 vector.lastIndexOf(“B”, 2); // returns 1 vector.lastIndexOf(“X”); // returns -1

This function requires the value type to have an implementation of operator==().

See also indexOf().

source

pub unsafe fn last_index_of_1a(&self, t: impl CastInto<Ref<QPointF>>) -> i32

Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.

Calls C++ function: int QVector<QPointF>::lastIndexOf(const QPointF& t) const.

C++ documentation:

Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.

Example:

QList<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.lastIndexOf(“B”); // returns 3 vector.lastIndexOf(“B”, 3); // returns 3 vector.lastIndexOf(“B”, 2); // returns 1 vector.lastIndexOf(“X”); // returns -1

This function requires the value type to have an implementation of operator==().

See also indexOf().

source

pub unsafe fn length(&self) -> i32

Same as size() and count().

Calls C++ function: int QVector<QPointF>::length() const.

C++ documentation:

Same as size() and count().

Provided for compatibility with QList.

This function was introduced in Qt 5.2.

See also size(), count(), and QList::length().

source

pub unsafe fn mid_2a(&self, pos: i32, len: i32) -> CppBox<QVectorOfQPointF>

Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.

Calls C++ function: QVector<QPointF> QVector<QPointF>::mid(int pos, int len = …) const.

C++ documentation:

Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.

source

pub unsafe fn mid_1a(&self, pos: i32) -> CppBox<QVectorOfQPointF>

Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.

Calls C++ function: QVector<QPointF> QVector<QPointF>::mid(int pos) const.

C++ documentation:

Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.

source

pub unsafe fn move_(&self, from: i32, to: i32)

Moves the item at index position from to index position to.

Calls C++ function: void QVector<QPointF>::move(int from, int to).

C++ documentation:

Moves the item at index position from to index position to.

Provided for compatibility with QList.

This function was introduced in Qt 5.6.

See also QList::move().

source

pub unsafe fn pop_back(&self)

This function is provided for STL compatibility. It is equivalent to removeLast().

Calls C++ function: void QVector<QPointF>::pop_back().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeLast().

source

pub unsafe fn pop_front(&self)

This function is provided for STL compatibility. It is equivalent to removeFirst().

Calls C++ function: void QVector<QPointF>::pop_front().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeFirst().

source

pub unsafe fn prepend(&self, t: impl CastInto<Ref<QPointF>>)

Inserts value at the beginning of the vector.

Calls C++ function: void QVector<QPointF>::prepend(const QPointF& t).

C++ documentation:

Inserts value at the beginning of the vector.

Example:

QVector<QString> vector; vector.prepend(“one”); vector.prepend(“two”); vector.prepend(“three”); // vector: [“three”, “two”, “one”]

This is the same as vector.insert(0, value).

For large vectors, this operation can be slow (linear time), because it requires moving all the items in the vector by one position further in memory. If you want a container class that provides a fast prepend() function, use QList or QLinkedList instead.

See also append() and insert().

source

pub unsafe fn push_back(&self, t: impl CastInto<Ref<QPointF>>)

This function is provided for STL compatibility. It is equivalent to append(value).

Calls C++ function: void QVector<QPointF>::push_back(const QPointF& t).

C++ documentation:

This function is provided for STL compatibility. It is equivalent to append(value).

source

pub unsafe fn push_front(&self, t: impl CastInto<Ref<QPointF>>)

This function is provided for STL compatibility. It is equivalent to prepend(value).

Calls C++ function: void QVector<QPointF>::push_front(const QPointF& t).

C++ documentation:

This function is provided for STL compatibility. It is equivalent to prepend(value).

source

pub unsafe fn remove_1a(&self, i: i32)

This is an overloaded function.

Calls C++ function: void QVector<QPointF>::remove(int i).

C++ documentation:

This is an overloaded function.

Removes the element at index position i.

See also insert(), replace(), and fill().

source

pub unsafe fn remove_2a(&self, i: i32, n: i32)

This is an overloaded function.

Calls C++ function: void QVector<QPointF>::remove(int i, int n).

C++ documentation:

This is an overloaded function.

Removes count elements from the middle of the vector, starting at index position i.

See also insert(), replace(), and fill().

source

pub unsafe fn remove_all(&self, t: impl CastInto<Ref<QPointF>>) -> i32

Removes all elements that compare equal to t from the vector. Returns the number of elements removed, if any.

Calls C++ function: int QVector<QPointF>::removeAll(const QPointF& t).

C++ documentation:

Removes all elements that compare equal to t from the vector. Returns the number of elements removed, if any.

Provided for compatibility with QList.

This function was introduced in Qt 5.4.

See also removeOne() and QList::removeAll().

source

pub unsafe fn remove_at(&self, i: i32)

Removes the element at index position i. Equivalent to

Calls C++ function: void QVector<QPointF>::removeAt(int i).

C++ documentation:

Removes the element at index position i. Equivalent to


  remove(i);

Provided for compatibility with QList.

This function was introduced in Qt 5.2.

See also remove() and QList::removeAt().

source

pub unsafe fn remove_first(&self)

Removes the first item in the vector. Calling this function is equivalent to calling remove(0). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.

Calls C++ function: void QVector<QPointF>::removeFirst().

C++ documentation:

Removes the first item in the vector. Calling this function is equivalent to calling remove(0). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.

This function was introduced in Qt 5.1.

See also remove(), takeFirst(), and isEmpty().

source

pub unsafe fn remove_last(&self)

Removes the last item in the vector. Calling this function is equivalent to calling remove(size() - 1). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.

Calls C++ function: void QVector<QPointF>::removeLast().

C++ documentation:

Removes the last item in the vector. Calling this function is equivalent to calling remove(size() - 1). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.

This function was introduced in Qt 5.1.

See also remove(), takeLast(), removeFirst(), and isEmpty().

source

pub unsafe fn remove_one(&self, t: impl CastInto<Ref<QPointF>>) -> bool

Removes the first element that compares equal to t from the vector. Returns whether an element was, in fact, removed.

Calls C++ function: bool QVector<QPointF>::removeOne(const QPointF& t).

C++ documentation:

Removes the first element that compares equal to t from the vector. Returns whether an element was, in fact, removed.

Provided for compatibility with QList.

This function was introduced in Qt 5.4.

See also removeAll() and QList::removeOne().

source

pub unsafe fn replace(&self, i: i32, t: impl CastInto<Ref<QPointF>>)

Replaces the item at index position i with value.

Calls C++ function: void QVector<QPointF>::replace(int i, const QPointF& t).

C++ documentation:

Replaces the item at index position i with value.

i must be a valid index position in the vector (i.e., 0 <= i < size()).

See also operator[]() and remove().

source

pub unsafe fn reserve(&self, size: i32)

Attempts to allocate memory for at least size elements. If you know in advance how large the vector will be, you should call this function to prevent reallocations and memory fragmentation.

Calls C++ function: void QVector<QPointF>::reserve(int size).

C++ documentation:

Attempts to allocate memory for at least size elements. If you know in advance how large the vector will be, you should call this function to prevent reallocations and memory fragmentation.

If size is an underestimate, the worst that will happen is that the QVector will be a bit slower. If size is an overestimate, you may have used more memory than the normal QVector growth strategy would have allocated—or you may have used less.

An alternative to reserve() is calling resize(). Whether or not that is faster than reserve() depends on the element type, because resize() default-constructs all elements, and requires assignment to existing entries rather than calling append(), which copy- or move-constructs. For simple types, like int or double, resize() is typically faster, but for anything more complex, you should prefer reserve().

Warning: If the size passed to resize() was underestimated, you run out of allocated space and into undefined behavior. This problem does not exist with reserve(), because it treats the size as just a hint.

See also squeeze() and capacity().

source

pub unsafe fn resize(&self, size: i32)

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Calls C++ function: void QVector<QPointF>::resize(int size).

C++ documentation:

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Since Qt 5.6, resize() doesn't shrink the capacity anymore. To shed excess capacity, use squeeze().

See also size().

source

pub unsafe fn set_sharable(&self, sharable: bool)

Calls C++ function: void QVector<QPointF>::setSharable(bool sharable).

source

pub unsafe fn shrink_to_fit(&self)

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function is provided for STL compatibility. It is equivalent to squeeze().

Calls C++ function: void QVector<QPointF>::shrink_to_fit().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to squeeze().

This function was introduced in Qt 5.10.

source

pub unsafe fn size(&self) -> i32

Returns the number of items in the vector.

Calls C++ function: int QVector<QPointF>::size() const.

C++ documentation:

Returns the number of items in the vector.

See also isEmpty() and resize().

source

pub unsafe fn squeeze(&self)

Releases any memory not required to store the items.

Calls C++ function: void QVector<QPointF>::squeeze().

C++ documentation:

Releases any memory not required to store the items.

The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function.

See also reserve() and capacity().

source

pub unsafe fn starts_with(&self, t: impl CastInto<Ref<QPointF>>) -> bool

Returns true if this vector is not empty and its first item is equal to value; otherwise returns false.

Calls C++ function: bool QVector<QPointF>::startsWith(const QPointF& t) const.

C++ documentation:

Returns true if this vector is not empty and its first item is equal to value; otherwise returns false.

This function was introduced in Qt 4.5.

See also isEmpty() and first().

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QVectorOfQPointF>>)

Swaps vector other with this vector. This operation is very fast and never fails.

Calls C++ function: void QVector<QPointF>::swap(QVector<QPointF>& other).

C++ documentation:

Swaps vector other with this vector. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

source

pub unsafe fn swap_items_at(&self, i: i32, j: i32)

Available on cpp_lib_version="5.14.0" only.

Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().

Calls C++ function: void QVector<QPointF>::swapItemsAt(int i, int j).

C++ documentation:

Exchange the item at index position i with the item at index position j. This function assumes that both i and j are at least 0 but less than size(). To avoid failure, test that both i and j are at least 0 and less than size().

This function was introduced in Qt 5.14.

source

pub unsafe fn take_at(&self, i: i32) -> CppBox<QPointF>

Removes the element at index position i and returns it.

Calls C++ function: QPointF QVector<QPointF>::takeAt(int i).

C++ documentation:

Removes the element at index position i and returns it.

Equivalent to

T t = at(i); remove(i); return t;

Provided for compatibility with QList.

This function was introduced in Qt 5.2.

See also takeFirst(), takeLast(), and QList::takeAt().

source

pub unsafe fn take_first(&self) -> CppBox<QPointF>

Removes the first item in the vector and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.

Calls C++ function: QPointF QVector<QPointF>::takeFirst().

C++ documentation:

Removes the first item in the vector and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.

This function was introduced in Qt 5.1.

See also takeLast() and removeFirst().

source

pub unsafe fn take_last(&self) -> CppBox<QPointF>

Removes the last item in the list and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.

Calls C++ function: QPointF QVector<QPointF>::takeLast().

C++ documentation:

Removes the last item in the list and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.

If you don't use the return value, removeLast() is more efficient.

This function was introduced in Qt 5.1.

See also takeFirst() and removeLast().

source

pub unsafe fn value_1a(&self, i: i32) -> CppBox<QPointF>

Returns the value at index position i in the vector.

Calls C++ function: QPointF QVector<QPointF>::value(int i) const.

C++ documentation:

Returns the value at index position i in the vector.

If the index i is out of bounds, the function returns a default-constructed value. If you are certain that i is within bounds, you can use at() instead, which is slightly faster.

See also at() and operator[]().

source

pub unsafe fn value_2a( &self, i: i32, default_value: impl CastInto<Ref<QPointF>> ) -> CppBox<QPointF>

This is an overloaded function.

Calls C++ function: QPointF QVector<QPointF>::value(int i, const QPointF& defaultValue) const.

C++ documentation:

This is an overloaded function.

If the index i is out of bounds, the function returns defaultValue.

Trait Implementations§

source§

impl CppDeletable for QPolygonF

source§

unsafe fn delete(&self)

Destroys the polygon.

Calls C++ function: [destructor] void QPolygonF::~QPolygonF().

C++ documentation:

Destroys the polygon.

source§

impl Deref for QPolygonF

source§

fn deref(&self) -> &QVectorOfQPointF

Calls C++ function: QVector<QPointF>* static_cast<QVector<QPointF>*>(QPolygonF* ptr).

§

type Target = QVectorOfQPointF

The resulting type after dereferencing.
source§

impl Mul<Ref<QMatrix>> for &QPolygonF

source§

fn mul(self, m: Ref<QMatrix>) -> CppBox<QPolygonF>

Calls C++ function: QPolygonF operator*(const QPolygonF& a, const QMatrix& m).

§

type Output = CppBox<QPolygonF>

The resulting type after applying the * operator.
source§

impl Mul<Ref<QTransform>> for &QPolygonF

source§

fn mul(self, m: Ref<QTransform>) -> CppBox<QPolygonF>

Calls C++ function: QPolygonF operator*(const QPolygonF& a, const QTransform& m).

§

type Output = CppBox<QPolygonF>

The resulting type after applying the * operator.
source§

impl StaticDowncast<QPolygonF> for QVectorOfQPointF

source§

unsafe fn static_downcast(ptr: Ptr<QVectorOfQPointF>) -> Ptr<QPolygonF>

Calls C++ function: QPolygonF* static_cast<QPolygonF*>(QVector<QPointF>* ptr).

source§

impl StaticUpcast<QVectorOfQPointF> for QPolygonF

source§

unsafe fn static_upcast(ptr: Ptr<QPolygonF>) -> Ptr<QVectorOfQPointF>

Calls C++ function: QVector<QPointF>* static_cast<QVector<QPointF>*>(QPolygonF* ptr).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.