[][src]Struct qt_widgets::QListOfQAbstractButton

#[repr(C)]pub struct QListOfQAbstractButton { /* fields omitted */ }

The QList class is a template class that provides lists.

C++ class: QList<QAbstractButton*>.

C++ documentation:

The QList class is a template class that provides lists.

QList<T> is one of Qt's generic container classes. It stores items in a list that provides fast index-based access and index-based insertions and removals.

QList<T>, QLinkedList<T>, and QVector<T> provide similar APIs and functionality. They are often interchangeable, but there are performance consequences. Here is an overview of use cases:

  • QVector should be your default first choice. QVector<T> will usually give better performance than QList<T>, because QVector<T> always stores its items sequentially in memory, where QList<T> will allocate its items on the heap unless sizeof(T) <= sizeof(void*) and T has been declared to be either a Q_MOVABLE_TYPE or a Q_PRIMITIVE_TYPE using Q_DECLARE_TYPEINFO. See the Pros and Cons of Using QList for an explanation.
  • However, QList is used throughout the Qt APIs for passing parameters and for returning values. Use QList to interface with those APIs.
  • If you need a real linked list, which guarantees constant time insertions mid-list and uses iterators to items rather than indexes, use QLinkedList.

Note: QVector and QVarLengthArray both guarantee C-compatible array layout. QList does not. This might be important if your application must interface with a C API.

Note: Iterators into a QLinkedList and references into heap-allocating QLists remain valid as long as the referenced items remain in the container. This is not true for iterators and references into a QVector and non-heap-allocating QLists.

Internally, QList<T> is represented as an array of T if sizeof(T) <= sizeof(void*) and T has been declared to be either a Q_MOVABLE_TYPE or a Q_PRIMITIVE_TYPE using Q_DECLARE_TYPEINFO. Otherwise, QList<T> is represented as an array of T* and the items are allocated on the heap.

The array representation allows very fast insertions and index-based access. The prepend() and append() operations are also very fast because QList preallocates memory at both ends of its internal array. (See Algorithmic Complexity for details.

Note, however, that when the conditions specified above are not met, each append or insert of a new item requires allocating the new item on the heap, and this per item allocation will make QVector a better choice for use cases that do a lot of appending or inserting, because QVector can allocate memory for many items in a single heap allocation.

Note that the internal array only ever gets bigger over the life of the list. It never shrinks. The internal array is deallocated by the destructor and by the assignment operator, when one list is assigned to another.

Here's an example of a QList that stores integers and a QList that stores QDate values:

QList<int> integerList; QList<QDate> dateList;

Qt includes a QStringList class that inherits QList<QString> and adds a few convenience functions, such as QStringList::join() and QStringList::filter(). QString::split() creates QStringLists from strings.

QList stores a list of items. The default constructor creates an empty list. To insert items into the list, you can use operator<<():

QList<QString> list; list << "one" << "two" << "three"; // list: ["one", "two", "three"]

QList provides these basic functions to add, move, and remove items: insert(), replace(), removeAt(), move(), and swap(). In addition, it provides the following convenience functions: append(), prepend(), removeFirst(), and removeLast().

QList uses 0-based indexes, just like C++ arrays. To access the item at a particular index position, you can use operator[](). On non-const lists, operator[]() returns a reference to the item and can be used on the left side of an assignment:

if (list[0] == "Bob") list[0] = "Robert";

Because QList is implemented as an array of pointers for types that are larger than a pointer or are not movable, this operation requires (constant time). For read-only access, an alternative syntax is to use at():

for (int i = 0; i < list.size(); ++i) { if (list.at(i) == "Jane") cout << "Found Jane at position " << i << endl; }

at() can be faster than operator[](), because it never causes a deep copy to occur.

A common requirement is to remove an item from a list and do something with it. For this, QList provides takeAt(), takeFirst(), and takeLast(). Here's a loop that removes the items from a list one at a time and calls delete on them:

QList<QWidget *> list; ... while (!list.isEmpty()) delete list.takeFirst();

Inserting and removing items at either end of the list is very fast (constant time in most cases), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.

If you want to find all occurrences of a particular value in a list, use indexOf() or lastIndexOf(). The former searches forward starting from a given index position, the latter searches backward. Both return the index of a matching item if they find it; otherwise, they return -1. For example:

int i = list.indexOf("Jane"); if (i != -1) cout << "First occurrence of Jane is at position " << i << endl;

If you simply want to check whether a list contains a particular value, use contains(). If you want to find out how many times a particular value occurs in the list, use count(). If you want to replace all occurrences of a particular value with another, use replace().

QList's value type must be an assignable data type. This covers most data types that are commonly used, but the compiler won't let you, for example, store a QWidget as a value; instead, store a QWidget *. A few functions have additional requirements; for example, indexOf() and lastIndexOf() expect the value type to support operator==(). These requirements are documented on a per-function basis.

Like the other container classes, QList provides Java-style iterators (QListIterator and QMutableListIterator) and STL-style iterators (QList::const_iterator and QList::iterator). In practice, these are rarely used, because you can use indexes into the QList. QList is implemented in such a way that direct index-based access is just as fast as using iterators.

QList does not support inserting, prepending, appending or replacing with references to its own values. Doing so will cause your application to abort with an error message.

To make QList as efficient as possible, its member functions don't validate their input before using it. Except for isEmpty(), member functions always assume the list is not empty. Member functions that take index values as parameters always assume their index value parameters are in the valid range. This means QList member functions can fail. If you define QT_NO_DEBUG when you compile, failures will not be detected. If you don't define QT_NO_DEBUG, failures will be detected using Q_ASSERT() or Q_ASSERT_X() with an appropriate message.

To avoid failures when your list can be empty, call isEmpty() before calling other member functions. If you must pass an index value that might not be in the valid range, check that it is less than the value returned by size() but not less than 0.

Methods

impl QListOfQAbstractButton[src]

pub unsafe fn add_assign_q_list_of_q_abstract_button(
    &self,
    l: impl CastInto<Ref<QListOfQAbstractButton>>
) -> Ref<QListOfQAbstractButton>
[src]

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

Calls C++ function: QList<QAbstractButton*>& QList<QAbstractButton*>::operator+=(const QList<QAbstractButton*>& l).

C++ documentation:

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

See also operator+() and append().

pub unsafe fn add_assign_q_abstract_button(
    &self,
    t: *const *mut QAbstractButton
) -> Ref<QListOfQAbstractButton>
[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>& QList<QAbstractButton*>::operator+=(const QAbstractButton*& t).

C++ documentation:

This is an overloaded function.

Appends value to the list.

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

pub unsafe fn append_q_abstract_button(&self, t: *const *mut QAbstractButton)[src]

Inserts value at the end of the list.

Calls C++ function: void QList<QAbstractButton*>::append(const QAbstractButton*& t).

C++ documentation:

Inserts value at the end of the list.

Example:

QList<QString> list; list.append("one"); list.append("two"); list.append("three"); // list: ["one", "two", "three"]

This is the same as list.insert(size(), value).

If this list is not shared, this operation is typically very fast (amortized constant time), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.

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

pub unsafe fn append_q_list_of_q_abstract_button(
    &self,
    t: impl CastInto<Ref<QListOfQAbstractButton>>
)
[src]

This is an overloaded function.

Calls C++ function: void QList<QAbstractButton*>::append(const QList<QAbstractButton*>& t).

C++ documentation:

This is an overloaded function.

Appends the items of the value list to this list.

This function was introduced in Qt 4.5.

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

pub unsafe fn at(&self, i: c_int) -> *const *mut QAbstractButton[src]

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::at(int i) const.

C++ documentation:

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

This function is very fast (constant time).

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

pub unsafe fn back_mut(&self) -> *mut *mut QAbstractButton[src]

This function is provided for STL compatibility. It is equivalent to last(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: QAbstractButton*& QList<QAbstractButton*>::back().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to last(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

pub unsafe fn back(&self) -> *const *mut QAbstractButton[src]

This is an overloaded function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::back() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn begin_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the first item in the list.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first item in the list.

See also constBegin() and end().

pub unsafe fn begin(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::begin() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn cbegin(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the first item in the list.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::cbegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first item in the list.

This function was introduced in Qt 5.0.

See also begin() and cend().

pub unsafe fn cend(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::cend() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.

This function was introduced in Qt 5.0.

See also cbegin() and end().

pub unsafe fn clear(&self)[src]

Removes all items from the list.

Calls C++ function: void QList<QAbstractButton*>::clear().

C++ documentation:

Removes all items from the list.

See also removeAll().

pub unsafe fn const_begin(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the first item in the list.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::constBegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first item in the list.

See also begin() and constEnd().

pub unsafe fn const_end(&self) -> CppBox<ConstIterator>[src]

Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::constEnd() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary item after the last item in the list.

See also constBegin() and end().

pub unsafe fn const_first(&self) -> *const *mut QAbstractButton[src]

Returns a const reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::constFirst() const.

C++ documentation:

Returns a const reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

This function was introduced in Qt 5.6.

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

pub unsafe fn const_last(&self) -> *const *mut QAbstractButton[src]

Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::constLast() const.

C++ documentation:

Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

This function was introduced in Qt 5.6.

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

pub unsafe fn contains(&self, t: *const *mut QAbstractButton) -> bool[src]

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

Calls C++ function: bool QList<QAbstractButton*>::contains(const QAbstractButton*& t) const.

C++ documentation:

Returns true if the list 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().

pub unsafe fn copy_from(
    &self,
    l: impl CastInto<Ref<QListOfQAbstractButton>>
) -> Ref<QListOfQAbstractButton>
[src]

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

Calls C++ function: QList<QAbstractButton*>& QList<QAbstractButton*>::operator=(const QList<QAbstractButton*>& l).

C++ documentation:

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

pub unsafe fn count_1a(&self, t: *const *mut QAbstractButton) -> c_int[src]

Returns the number of occurrences of value in the list.

Calls C++ function: int QList<QAbstractButton*>::count(const QAbstractButton*& t) const.

C++ documentation:

Returns the number of occurrences of value in the list.

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

See also contains() and indexOf().

pub unsafe fn count_0a(&self) -> c_int[src]

Returns the number of items in the list. This is effectively the same as size().

Calls C++ function: int QList<QAbstractButton*>::count() const.

C++ documentation:

Returns the number of items in the list. This is effectively the same as size().

pub unsafe fn detach(&self)[src]

Calls C++ function: void QList<QAbstractButton*>::detach().

pub unsafe fn detach_shared(&self)[src]

Calls C++ function: void QList<QAbstractButton*>::detachShared().

pub unsafe fn empty(&self) -> bool[src]

This function is provided for STL compatibility. It is equivalent to isEmpty() and returns true if the list is empty.

Calls C++ function: bool QList<QAbstractButton*>::empty() const.

C++ documentation:

This function is provided for STL compatibility. It is equivalent to isEmpty() and returns true if the list is empty.

pub unsafe fn end_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the imaginary item after the last item in the list.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary item after the last item in the list.

See also begin() and constEnd().

pub unsafe fn end(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::end() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn ends_with(&self, t: *const *mut QAbstractButton) -> bool[src]

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

Calls C++ function: bool QList<QAbstractButton*>::endsWith(const QAbstractButton*& t) const.

C++ documentation:

Returns true if this list 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 contains().

pub unsafe fn erase_1a(
    &self,
    pos: impl CastInto<Ref<Iterator>>
) -> CppBox<Iterator>
[src]

Removes the item associated with the iterator pos from the list, and returns an iterator to the next item in the list (which may be end()).

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::erase(QList<QAbstractButton*>::iterator pos).

C++ documentation:

Removes the item associated with the iterator pos from the list, and returns an iterator to the next item in the list (which may be end()).

See also insert() and removeAt().

pub unsafe fn erase_2a(
    &self,
    first: impl CastInto<Ref<Iterator>>,
    last: impl CastInto<Ref<Iterator>>
) -> CppBox<Iterator>
[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::erase(QList<QAbstractButton*>::iterator first, QList<QAbstractButton*>::iterator last).

C++ documentation:

This is an overloaded function.

Removes all the items from begin up to (but not including) end. Returns an iterator to the same item that end referred to before the call.

pub unsafe fn first_mut(&self) -> *mut *mut QAbstractButton[src]

Returns a reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: QAbstractButton*& QList<QAbstractButton*>::first().

C++ documentation:

Returns a reference to the first item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

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

pub unsafe fn first(&self) -> *const *mut QAbstractButton[src]

This is an overloaded function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::first() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn front_mut(&self) -> *mut *mut QAbstractButton[src]

This function is provided for STL compatibility. It is equivalent to first(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: QAbstractButton*& QList<QAbstractButton*>::front().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to first(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

pub unsafe fn front(&self) -> *const *mut QAbstractButton[src]

This is an overloaded function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::front() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn index(&self, i: c_int) -> *const *mut QAbstractButton[src]

This is an overloaded function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::operator[](int i) const.

C++ documentation:

This is an overloaded function.

Same as at(). This function runs in constant time.

pub unsafe fn index_mut(&self, i: c_int) -> *mut *mut QAbstractButton[src]

Returns the item at index position i as a modifiable reference. i must be a valid index position in the list (i.e., 0 <= i < size()).

Calls C++ function: QAbstractButton*& QList<QAbstractButton*>::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 list (i.e., 0 <= i < size()).

If this function is called on a list that is currently being shared, it will trigger a copy of all elements. Otherwise, this function runs in constant time. If you do not want to modify the list you should use QList::at().

See also at() and value().

pub unsafe fn index_of_2a(
    &self,
    t: *const *mut QAbstractButton,
    from: c_int
) -> c_int
[src]

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

Calls C++ function: int QList<QAbstractButton*>::indexOf(const QAbstractButton*& t, int from = …) const.

C++ documentation:

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

Example:

QList<QString> list; list << "A" << "B" << "C" << "B" << "A"; list.indexOf("B"); // returns 1 list.indexOf("B", 1); // returns 1 list.indexOf("B", 2); // returns 3 list.indexOf("X"); // returns -1

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

Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.

See also lastIndexOf() and contains().

pub unsafe fn index_of_1a(&self, t: *const *mut QAbstractButton) -> c_int[src]

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

Calls C++ function: int QList<QAbstractButton*>::indexOf(const QAbstractButton*& t) const.

C++ documentation:

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

Example:

QList<QString> list; list << "A" << "B" << "C" << "B" << "A"; list.indexOf("B"); // returns 1 list.indexOf("B", 1); // returns 1 list.indexOf("B", 2); // returns 3 list.indexOf("X"); // returns -1

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

Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.

See also lastIndexOf() and contains().

pub unsafe fn insert_int_q_abstract_button(
    &self,
    i: c_int,
    t: *const *mut QAbstractButton
)
[src]

Inserts value at index position i in the list. If i <= 0, the value is prepended to the list. If i >= size(), the value is appended to the list.

Calls C++ function: void QList<QAbstractButton*>::insert(int i, const QAbstractButton*& t).

C++ documentation:

Inserts value at index position i in the list. If i <= 0, the value is prepended to the list. If i >= size(), the value is appended to the list.

Example:

QList<QString> list; list << "alpha" << "beta" << "delta"; list.insert(2, "gamma"); // list: ["alpha", "beta", "gamma", "delta"]

See also append(), prepend(), replace(), and removeAt().

pub unsafe fn insert_iterator_q_abstract_button(
    &self,
    before: impl CastInto<Ref<Iterator>>,
    t: *const *mut QAbstractButton
) -> CppBox<Iterator>
[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::insert(QList<QAbstractButton*>::iterator before, const QAbstractButton*& t).

C++ documentation:

This is an overloaded function.

Inserts value in front of the item pointed to by the iterator before. Returns an iterator pointing at the inserted item. Note that the iterator passed to the function will be invalid after the call; the returned iterator should be used instead.

pub unsafe fn is_detached(&self) -> bool[src]

Calls C++ function: bool QList<QAbstractButton*>::isDetached() const.

pub unsafe fn is_empty(&self) -> bool[src]

Returns true if the list contains no items; otherwise returns false.

Calls C++ function: bool QList<QAbstractButton*>::isEmpty() const.

C++ documentation:

Returns true if the list contains no items; otherwise returns false.

See also size().

pub unsafe fn is_shared_with(
    &self,
    other: impl CastInto<Ref<QListOfQAbstractButton>>
) -> bool
[src]

Calls C++ function: bool QList<QAbstractButton*>::isSharedWith(const QList<QAbstractButton*>& other) const.

pub unsafe fn last_mut(&self) -> *mut *mut QAbstractButton[src]

Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: QAbstractButton*& QList<QAbstractButton*>::last().

C++ documentation:

Returns a reference to the last item in the list. The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

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

pub unsafe fn last(&self) -> *const *mut QAbstractButton[src]

This is an overloaded function.

Calls C++ function: const QAbstractButton*& QList<QAbstractButton*>::last() const.

C++ documentation:

This is an overloaded function.

pub unsafe fn last_index_of_2a(
    &self,
    t: *const *mut QAbstractButton,
    from: c_int
) -> c_int
[src]

Returns the index position of the last occurrence of value in the list, 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 QList<QAbstractButton*>::lastIndexOf(const QAbstractButton*& t, int from = …) const.

C++ documentation:

Returns the index position of the last occurrence of value in the list, 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> list; list << "A" << "B" << "C" << "B" << "A"; list.lastIndexOf("B"); // returns 3 list.lastIndexOf("B", 3); // returns 3 list.lastIndexOf("B", 2); // returns 1 list.lastIndexOf("X"); // returns -1

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

Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.

See also indexOf().

pub unsafe fn last_index_of_1a(&self, t: *const *mut QAbstractButton) -> c_int[src]

Returns the index position of the last occurrence of value in the list, 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 QList<QAbstractButton*>::lastIndexOf(const QAbstractButton*& t) const.

C++ documentation:

Returns the index position of the last occurrence of value in the list, 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> list; list << "A" << "B" << "C" << "B" << "A"; list.lastIndexOf("B"); // returns 3 list.lastIndexOf("B", 3); // returns 3 list.lastIndexOf("B", 2); // returns 1 list.lastIndexOf("X"); // returns -1

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

Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above.

See also indexOf().

pub unsafe fn length(&self) -> c_int[src]

This function is identical to count().

Calls C++ function: int QList<QAbstractButton*>::length() const.

C++ documentation:

This function is identical to count().

This function was introduced in Qt 4.5.

See also count().

pub unsafe fn mid_2a(
    &self,
    pos: c_int,
    length: c_int
) -> CppBox<QListOfQAbstractButton>
[src]

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

Calls C++ function: QList<QAbstractButton*> QList<QAbstractButton*>::mid(int pos, int length = …) const.

C++ documentation:

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

pub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QListOfQAbstractButton>[src]

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

Calls C++ function: QList<QAbstractButton*> QList<QAbstractButton*>::mid(int pos) const.

C++ documentation:

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

pub unsafe fn move_(&self, from: c_int, to: c_int)[src]

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

Calls C++ function: void QList<QAbstractButton*>::move(int from, int to).

C++ documentation:

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

Example:

QList<QString> list; list << "A" << "B" << "C" << "D" << "E" << "F"; list.move(1, 4); // list: ["A", "C", "D", "E", "B", "F"]

This is the same as insert(to, takeAt(from)).This function assumes that both from and to are at least 0 but less than size(). To avoid failure, test that both from and to are at least 0 and less than size().

See also swap(), insert(), and takeAt().

pub unsafe fn new() -> CppBox<QListOfQAbstractButton>[src]

Constructs an empty list.

Calls C++ function: [constructor] void QList<QAbstractButton*>::QList().

C++ documentation:

Constructs an empty list.

pub unsafe fn new_copy(
    l: impl CastInto<Ref<QListOfQAbstractButton>>
) -> CppBox<QListOfQAbstractButton>
[src]

Constructs a copy of other.

Calls C++ function: [constructor] void QList<QAbstractButton*>::QList(const QList<QAbstractButton*>& l).

C++ documentation:

Constructs a copy of other.

This operation takes constant time, because QList is implicitly shared. This makes returning a QList from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.

See also operator=().

pub unsafe fn pop_back(&self)[src]

This function is provided for STL compatibility. It is equivalent to removeLast(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: void QList<QAbstractButton*>::pop_back().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeLast(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

pub unsafe fn pop_front(&self)[src]

This function is provided for STL compatibility. It is equivalent to removeFirst(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

Calls C++ function: void QList<QAbstractButton*>::pop_front().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to removeFirst(). The list must not be empty. If the list can be empty, call isEmpty() before calling this function.

pub unsafe fn prepend(&self, t: *const *mut QAbstractButton)[src]

Inserts value at the beginning of the list.

Calls C++ function: void QList<QAbstractButton*>::prepend(const QAbstractButton*& t).

C++ documentation:

Inserts value at the beginning of the list.

Example:

QList<QString> list; list.prepend("one"); list.prepend("two"); list.prepend("three"); // list: ["three", "two", "one"]

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

If this list is not shared, this operation is typically very fast (amortized constant time), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.

See also append() and insert().

pub unsafe fn push_back(&self, t: *const *mut QAbstractButton)[src]

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

Calls C++ function: void QList<QAbstractButton*>::push_back(const QAbstractButton*& t).

C++ documentation:

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

pub unsafe fn push_front(&self, t: *const *mut QAbstractButton)[src]

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

Calls C++ function: void QList<QAbstractButton*>::push_front(const QAbstractButton*& t).

C++ documentation:

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

pub unsafe fn remove_all(&self, t: *const *mut QAbstractButton) -> c_int[src]

Removes all occurrences of value in the list and returns the number of entries removed.

Calls C++ function: int QList<QAbstractButton*>::removeAll(const QAbstractButton*& t).

C++ documentation:

Removes all occurrences of value in the list and returns the number of entries removed.

Example:

QList<QString> list; list << "sun" << "cloud" << "sun" << "rain"; list.removeAll("sun"); // list: ["cloud", "rain"]

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

See also removeOne(), removeAt(), takeAt(), and replace().

pub unsafe fn remove_at(&self, i: c_int)[src]

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Calls C++ function: void QList<QAbstractButton*>::removeAt(int i).

C++ documentation:

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

See also takeAt(), removeFirst(), removeLast(), and removeOne().

pub unsafe fn remove_first(&self)[src]

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

Calls C++ function: void QList<QAbstractButton*>::removeFirst().

C++ documentation:

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

See also removeAt() and takeFirst().

pub unsafe fn remove_last(&self)[src]

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

Calls C++ function: void QList<QAbstractButton*>::removeLast().

C++ documentation:

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

See also removeAt() and takeLast().

pub unsafe fn remove_one(&self, t: *const *mut QAbstractButton) -> bool[src]

Removes the first occurrence of value in the list and returns true on success; otherwise returns false.

Calls C++ function: bool QList<QAbstractButton*>::removeOne(const QAbstractButton*& t).

C++ documentation:

Removes the first occurrence of value in the list and returns true on success; otherwise returns false.

Example:

QList<QString> list; list << "sun" << "cloud" << "sun" << "rain"; list.removeOne("sun"); // list: ["cloud", ,"sun", "rain"]

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

This function was introduced in Qt 4.4.

See also removeAll(), removeAt(), takeAt(), and replace().

pub unsafe fn replace(&self, i: c_int, t: *const *mut QAbstractButton)[src]

Replaces the item at index position i with value. i must be a valid index position in the list (i.e., 0 <= i < size()).

Calls C++ function: void QList<QAbstractButton*>::replace(int i, const QAbstractButton*& t).

C++ documentation:

Replaces the item at index position i with value. i must be a valid index position in the list (i.e., 0 <= i < size()).

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

pub unsafe fn reserve(&self, size: c_int)[src]

Reserve space for alloc elements.

Calls C++ function: void QList<QAbstractButton*>::reserve(int size).

C++ documentation:

Reserve space for alloc elements.

If alloc is smaller than the current size of the list, nothing will happen.

Use this function to avoid repetetive reallocation of QList's internal data if you can predict how many elements will be appended. Note that the reservation applies only to the internal pointer array.

This function was introduced in Qt 4.7.

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

Calls C++ function: void QList<QAbstractButton*>::setSharable(bool sharable).

pub unsafe fn size(&self) -> c_int[src]

Returns the number of items in the list.

Calls C++ function: int QList<QAbstractButton*>::size() const.

C++ documentation:

Returns the number of items in the list.

See also isEmpty() and count().

pub unsafe fn starts_with(&self, t: *const *mut QAbstractButton) -> bool[src]

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

Calls C++ function: bool QList<QAbstractButton*>::startsWith(const QAbstractButton*& t) const.

C++ documentation:

Returns true if this list 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 contains().

pub unsafe fn swap_1a(&self, other: impl CastInto<Ref<QListOfQAbstractButton>>)[src]

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

Calls C++ function: void QList<QAbstractButton*>::swap(QList<QAbstractButton*>& other).

C++ documentation:

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

This function was introduced in Qt 4.8.

pub unsafe fn swap_2a(&self, i: c_int, j: c_int)[src]

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 QList<QAbstractButton*>::swap(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().

Example:

QList<QString> list; list << "A" << "B" << "C" << "D" << "E" << "F"; list.swap(1, 4); // list: ["A", "E", "C", "D", "B", "F"]

See also move().

pub unsafe fn swap_items_at(&self, i: c_int, j: c_int)[src]

This is supported on cpp_lib_version="5.13.0" or 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 QList<QAbstractButton*>::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().

Example:

QList<QString> list; list << "A" << "B" << "C" << "D" << "E" << "F"; list.swapItemsAt(1, 4); // list: ["A", "E", "C", "D", "B", "F"]

This function was introduced in Qt 5.13.

See also move().

pub unsafe fn take_at(&self, i: c_int) -> QPtr<QAbstractButton>[src]

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Calls C++ function: QAbstractButton* QList<QAbstractButton*>::takeAt(int i).

C++ documentation:

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

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

See also removeAt(), takeFirst(), and takeLast().

pub unsafe fn take_first(&self) -> QPtr<QAbstractButton>[src]

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

Calls C++ function: QAbstractButton* QList<QAbstractButton*>::takeFirst().

C++ documentation:

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

If this list is not shared, this operation takes constant time.

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

See also takeLast(), takeAt(), and removeFirst().

pub unsafe fn take_last(&self) -> QPtr<QAbstractButton>[src]

Removes the last item in the list and returns it. This is the same as takeAt(size() - 1). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.

Calls C++ function: QAbstractButton* QList<QAbstractButton*>::takeLast().

C++ documentation:

Removes the last item in the list and returns it. This is the same as takeAt(size() - 1). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function.

If this list is not shared, this operation takes constant time.

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

See also takeFirst(), takeAt(), and removeLast().

pub unsafe fn value_1a(&self, i: c_int) -> QPtr<QAbstractButton>[src]

Returns the value at index position i in the list.

Calls C++ function: QAbstractButton* QList<QAbstractButton*>::value(int i) const.

C++ documentation:

Returns the value at index position i in the list.

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

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

pub unsafe fn value_2a(
    &self,
    i: c_int,
    default_value: *const *mut QAbstractButton
) -> QPtr<QAbstractButton>
[src]

This is an overloaded function.

Calls C++ function: QAbstractButton* QList<QAbstractButton*>::value(int i, const QAbstractButton*& defaultValue) const.

C++ documentation:

This is an overloaded function.

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

Trait Implementations

impl<'_> Add<Ref<QListOfQAbstractButton>> for &'_ QListOfQAbstractButton[src]

type Output = CppBox<QListOfQAbstractButton>

The resulting type after applying the + operator.

fn add(self, l: Ref<QListOfQAbstractButton>) -> CppBox<QListOfQAbstractButton>[src]

Returns a list that contains all the items in this list followed by all the items in the other list.

Calls C++ function: QList<QAbstractButton*> QList<QAbstractButton*>::operator+(const QList<QAbstractButton*>& l) const.

C++ documentation:

Returns a list that contains all the items in this list followed by all the items in the other list.

See also operator+=().

impl Begin for QListOfQAbstractButton[src]

type Output = CppBox<ConstIterator>

Output type.

unsafe fn begin(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::begin() const.

C++ documentation:

This is an overloaded function.

impl BeginMut for QListOfQAbstractButton[src]

type Output = CppBox<Iterator>

Output type.

unsafe fn begin_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the first item in the list.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first item in the list.

See also constBegin() and end().

impl CppDeletable for QListOfQAbstractButton[src]

unsafe fn delete(&self)[src]

Destroys the list. References to the values in the list and all iterators of this list become invalid.

Calls C++ function: [destructor] void QList<QAbstractButton*>::~QList().

C++ documentation:

Destroys the list. References to the values in the list and all iterators of this list become invalid.

impl End for QListOfQAbstractButton[src]

type Output = CppBox<ConstIterator>

Output type.

unsafe fn end(&self) -> CppBox<ConstIterator>[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>::const_iterator QList<QAbstractButton*>::end() const.

C++ documentation:

This is an overloaded function.

impl EndMut for QListOfQAbstractButton[src]

type Output = CppBox<Iterator>

Output type.

unsafe fn end_mut(&self) -> CppBox<Iterator>[src]

Returns an STL-style iterator pointing to the imaginary item after the last item in the list.

Calls C++ function: QList<QAbstractButton*>::iterator QList<QAbstractButton*>::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary item after the last item in the list.

See also begin() and constEnd().

impl Ge<Ref<QListOfQAbstractButton>> for QListOfQAbstractButton[src]

unsafe fn ge(&self, rhs: &Ref<QListOfQAbstractButton>) -> bool[src]

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator>=(const QList<QAbstractButton*>& lhs, const QList<QAbstractButton*>& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

impl Gt<Ref<QListOfQAbstractButton>> for QListOfQAbstractButton[src]

unsafe fn gt(&self, rhs: &Ref<QListOfQAbstractButton>) -> bool[src]

Calls C++ function: bool operator>(const QList<QAbstractButton*>& lhs, const QList<QAbstractButton*>& rhs).

impl Le<Ref<QListOfQAbstractButton>> for QListOfQAbstractButton[src]

unsafe fn le(&self, rhs: &Ref<QListOfQAbstractButton>) -> bool[src]

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator<=(const QList<QAbstractButton*>& lhs, const QList<QAbstractButton*>& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

impl Lt<Ref<QListOfQAbstractButton>> for QListOfQAbstractButton[src]

unsafe fn lt(&self, rhs: &Ref<QListOfQAbstractButton>) -> bool[src]

Calls C++ function: bool operator<(const QList<QAbstractButton*>& lhs, const QList<QAbstractButton*>& rhs).

impl PartialEq<Ref<QListOfQAbstractButton>> for QListOfQAbstractButton[src]

fn eq(&self, l: &Ref<QListOfQAbstractButton>) -> bool[src]

Returns true if other is equal to this list; otherwise returns false.

Calls C++ function: bool QList<QAbstractButton*>::operator==(const QList<QAbstractButton*>& l) const.

C++ documentation:

Returns true if other is equal to this list; otherwise returns false.

Two lists are considered equal if they contain the same values in the same order.

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

See also operator!=().

impl<'_> Shl<*const *mut QAbstractButton> for &'_ QListOfQAbstractButton[src]

type Output = Ref<QListOfQAbstractButton>

The resulting type after applying the << operator.

fn shl(self, t: *const *mut QAbstractButton) -> Ref<QListOfQAbstractButton>[src]

This is an overloaded function.

Calls C++ function: QList<QAbstractButton*>& QList<QAbstractButton*>::operator<<(const QAbstractButton*& t).

C++ documentation:

This is an overloaded function.

Appends value to the list.

impl<'_> Shl<Ref<QListOfQAbstractButton>> for &'_ QListOfQAbstractButton[src]

type Output = Ref<QListOfQAbstractButton>

The resulting type after applying the << operator.

fn shl(self, l: Ref<QListOfQAbstractButton>) -> Ref<QListOfQAbstractButton>[src]

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

Calls C++ function: QList<QAbstractButton*>& QList<QAbstractButton*>::operator<<(const QList<QAbstractButton*>& l).

C++ documentation:

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

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

impl Size for QListOfQAbstractButton[src]

unsafe fn size(&self) -> usize[src]

Returns the number of items in the list.

Calls C++ function: int QList<QAbstractButton*>::size() const.

C++ documentation:

Returns the number of items in the list.

See also isEmpty() and count().

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.