Struct qt_core::QSetOfQAbstractState
source · #[repr(C)]pub struct QSetOfQAbstractState { /* private fields */ }
Expand description
The QSet class is a template class that provides a hash-table-based set.
C++ class: QSet<QAbstractState*>
.
The QSet class is a template class that provides a hash-table-based set.
QSet<T> is one of Qt's generic container classes. It stores values in an unspecified order and provides very fast lookup of the values. Internally, QSet<T> is implemented as a QHash.
Here's an example QSet with QString values:
To insert a value into the set, use insert():
set.insert(“one”); set.insert(“three”); set.insert(“seven”);
Another way to insert items into the set is to use operator<<():
set << “twelve” << “fifteen” << “nineteen”;
To test whether an item belongs to the set or not, use contains():
if (!set.contains(“ninety-nine”)) ...
If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both Java-style iterators (QSetIterator and QMutableSetIterator) and STL-style iterators (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet<QWidget *> using a Java-style iterator:
QSetIterator<QWidget *> i(set); while (i.hasNext()) qDebug() << i.next();
Here's the same code, but using an STL-style iterator:
QSet<QWidget >::const_iterator i = set.constBegin(); while (i != set.constEnd()) { qDebug() << i; ++i; }
QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap.
To navigate through a QSet, you can also use foreach:
QSet<QString> set; ... foreach (const QString &value, set) qDebug() << value;
Items can be removed from the set using remove(). There is also a clear() function that removes all items.
QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide operator==()
, and there must also be a global qHash() function that returns a hash value for an argument of the key's type. See the QHash documentation for a list of types supported by qHash().
Internally, QSet uses a hash table to perform lookups. The hash table automatically grows and shrinks to provide fast lookups without wasting memory. You can still control the size of the hash table by calling reserve(), if you already know approximately how many elements the QSet will contain, but this isn't necessary to obtain good performance. You can also call capacity() to retrieve the hash table's size.
Implementations§
source§impl QSetOfQAbstractState
impl QSetOfQAbstractState
sourcepub unsafe fn add_assign_q_set_of_q_abstract_state(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn add_assign_q_set_of_q_abstract_state( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Same as unite(other).
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator+=(const QSet<QAbstractState*>& other)
.
Same as unite(other).
See also operator|(), operator&=(), and operator-=().
sourcepub unsafe fn add_assign_q_abstract_state(
&self,
value: *const *mut QAbstractState
) -> Ref<QSetOfQAbstractState>
pub unsafe fn add_assign_q_abstract_state( &self, value: *const *mut QAbstractState ) -> Ref<QSetOfQAbstractState>
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator+=(const QAbstractState*& value)
.
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
See also insert().
sourcepub unsafe fn begin_mut(&self) -> CppBox<Iterator>
pub unsafe fn begin_mut(&self) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::begin()
.
This is an overloaded function.
Returns a non-const STL-style iterator positioned at the first item in the set.
This function was introduced in Qt 4.2.
sourcepub unsafe fn begin(&self) -> CppBox<ConstIterator>
pub unsafe fn begin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the first item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::begin() const
.
Returns a const STL-style iterator positioned at the first item in the set.
See also constBegin() and end().
sourcepub unsafe fn bit_and_assign_q_set_of_q_abstract_state(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn bit_and_assign_q_set_of_q_abstract_state( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Same as intersect(other).
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator&=(const QSet<QAbstractState*>& other)
.
Same as intersect(other).
See also operator&(), operator|=(), and operator-=().
sourcepub unsafe fn bit_and_assign_q_abstract_state(
&self,
value: *const *mut QAbstractState
) -> Ref<QSetOfQAbstractState>
pub unsafe fn bit_and_assign_q_abstract_state( &self, value: *const *mut QAbstractState ) -> Ref<QSetOfQAbstractState>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator&=(const QAbstractState*& value)
.
This is an overloaded function.
Same as intersect(other), if we consider other to be a set that contains the singleton value.
sourcepub unsafe fn bit_or_assign_q_set_of_q_abstract_state(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn bit_or_assign_q_set_of_q_abstract_state( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Same as unite(other).
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator|=(const QSet<QAbstractState*>& other)
.
Same as unite(other).
See also operator|(), operator&=(), and operator-=().
sourcepub unsafe fn bit_or_assign_q_abstract_state(
&self,
value: *const *mut QAbstractState
) -> Ref<QSetOfQAbstractState>
pub unsafe fn bit_or_assign_q_abstract_state( &self, value: *const *mut QAbstractState ) -> Ref<QSetOfQAbstractState>
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator|=(const QAbstractState*& value)
.
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
See also insert().
sourcepub unsafe fn capacity(&self) -> c_int
pub unsafe fn capacity(&self) -> c_int
Returns the number of buckets in the set's internal hash table.
Calls C++ function: int QSet<QAbstractState*>::capacity() const
.
sourcepub unsafe fn cbegin(&self) -> CppBox<ConstIterator>
pub unsafe fn cbegin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the first item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::cbegin() const
.
Returns a const STL-style iterator positioned at the first item in the set.
This function was introduced in Qt 5.0.
sourcepub unsafe fn cend(&self) -> CppBox<ConstIterator>
pub unsafe fn cend(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the imaginary item after the last item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::cend() const
.
Returns a const STL-style iterator pointing to the imaginary item after the last item in the set.
This function was introduced in Qt 5.0.
sourcepub unsafe fn clear(&self)
pub unsafe fn clear(&self)
Removes all elements from the set.
Calls C++ function: void QSet<QAbstractState*>::clear()
.
Removes all elements from the set.
See also remove().
sourcepub unsafe fn const_begin(&self) -> CppBox<ConstIterator>
pub unsafe fn const_begin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the first item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::constBegin() const
.
Returns a const STL-style iterator positioned at the first item in the set.
sourcepub unsafe fn const_end(&self) -> CppBox<ConstIterator>
pub unsafe fn const_end(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator pointing to the imaginary item after the last item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::constEnd() const
.
Returns a const STL-style iterator pointing to the imaginary item after the last item in the set.
See also constBegin() and end().
sourcepub unsafe fn const_find(
&self,
value: *const *mut QAbstractState
) -> CppBox<ConstIterator>
pub unsafe fn const_find( &self, value: *const *mut QAbstractState ) -> CppBox<ConstIterator>
Returns a const iterator positioned at the item value in the set. If the set contains no item value, the function returns constEnd().
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::constFind(const QAbstractState*& value) const
.
sourcepub unsafe fn contains_q_abstract_state(
&self,
value: *const *mut QAbstractState
) -> bool
pub unsafe fn contains_q_abstract_state( &self, value: *const *mut QAbstractState ) -> bool
Returns true
if the set contains item value; otherwise returns false.
Calls C++ function: bool QSet<QAbstractState*>::contains(const QAbstractState*& value) const
.
sourcepub unsafe fn contains_q_set_of_q_abstract_state(
&self,
set: impl CastInto<Ref<QSetOfQAbstractState>>
) -> bool
pub unsafe fn contains_q_set_of_q_abstract_state( &self, set: impl CastInto<Ref<QSetOfQAbstractState>> ) -> bool
Returns true
if the set contains all items from the other set; otherwise returns false
.
Calls C++ function: bool QSet<QAbstractState*>::contains(const QSet<QAbstractState*>& set) const
.
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
The QSet class is a template class that provides a hash-table-based set.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator=(const QSet<QAbstractState*>& other)
.
The QSet class is a template class that provides a hash-table-based set.
QSet<T> is one of Qt's generic container classes. It stores values in an unspecified order and provides very fast lookup of the values. Internally, QSet<T> is implemented as a QHash.
Here's an example QSet with QString values:
To insert a value into the set, use insert():
set.insert(“one”); set.insert(“three”); set.insert(“seven”);
Another way to insert items into the set is to use operator<<():
set << “twelve” << “fifteen” << “nineteen”;
To test whether an item belongs to the set or not, use contains():
if (!set.contains(“ninety-nine”)) ...
If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both Java-style iterators (QSetIterator and QMutableSetIterator) and STL-style iterators (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet<QWidget *> using a Java-style iterator:
QSetIterator<QWidget *> i(set); while (i.hasNext()) qDebug() << i.next();
Here's the same code, but using an STL-style iterator:
QSet<QWidget >::const_iterator i = set.constBegin(); while (i != set.constEnd()) { qDebug() << i; ++i; }
QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap.
To navigate through a QSet, you can also use foreach:
QSet<QString> set; ... foreach (const QString &value, set) qDebug() << value;
Items can be removed from the set using remove(). There is also a clear() function that removes all items.
QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide operator==()
, and there must also be a global qHash() function that returns a hash value for an argument of the key's type. See the QHash documentation for a list of types supported by qHash().
Internally, QSet uses a hash table to perform lookups. The hash table automatically grows and shrinks to provide fast lookups without wasting memory. You can still control the size of the hash table by calling reserve(), if you already know approximately how many elements the QSet will contain, but this isn't necessary to obtain good performance. You can also call capacity() to retrieve the hash table's size.
sourcepub unsafe fn count(&self) -> c_int
pub unsafe fn count(&self) -> c_int
sourcepub unsafe fn empty(&self) -> bool
pub unsafe fn empty(&self) -> bool
sourcepub unsafe fn end_mut(&self) -> CppBox<Iterator>
pub unsafe fn end_mut(&self) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::end()
.
This is an overloaded function.
Returns a non-const STL-style iterator pointing to the imaginary item after the last item in the set.
This function was introduced in Qt 4.2.
sourcepub unsafe fn end(&self) -> CppBox<ConstIterator>
pub unsafe fn end(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the imaginary item after the last item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::end() const
.
Returns a const STL-style iterator positioned at the imaginary item after the last item in the set.
sourcepub unsafe fn erase_iterator(
&self,
i: impl CastInto<Ref<Iterator>>
) -> CppBox<Iterator>
pub unsafe fn erase_iterator( &self, i: impl CastInto<Ref<Iterator>> ) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::erase(QSet<QAbstractState*>::iterator i)
.
This is an overloaded function.
This function was introduced in Qt 4.2.
sourcepub unsafe fn erase_const_iterator(
&self,
i: impl CastInto<Ref<ConstIterator>>
) -> CppBox<Iterator>
pub unsafe fn erase_const_iterator( &self, i: impl CastInto<Ref<ConstIterator>> ) -> CppBox<Iterator>
Removes the item at the iterator position pos from the set, and returns an iterator positioned at the next item in the set.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::erase(QSet<QAbstractState*>::const_iterator i)
.
Removes the item at the iterator position pos from the set, and returns an iterator positioned at the next item in the set.
Unlike remove(), this function never causes QSet to rehash its internal data structure. This means that it can safely be called while iterating, and won't affect the order of items in the set.
This function was introduced in Qt 5.7.
sourcepub unsafe fn find_mut(
&self,
value: *const *mut QAbstractState
) -> CppBox<Iterator>
pub unsafe fn find_mut( &self, value: *const *mut QAbstractState ) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::find(const QAbstractState*& value)
.
This is an overloaded function.
Returns a non-const iterator positioned at the item value in the set. If the set contains no item value, the function returns end().
This function was introduced in Qt 4.2.
sourcepub unsafe fn find(
&self,
value: *const *mut QAbstractState
) -> CppBox<ConstIterator>
pub unsafe fn find( &self, value: *const *mut QAbstractState ) -> CppBox<ConstIterator>
Returns a const iterator positioned at the item value in the set. If the set contains no item value, the function returns constEnd().
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::find(const QAbstractState*& value) const
.
sourcepub unsafe fn from_list(
list: impl CastInto<Ref<QListOfQAbstractState>>
) -> CppBox<QSetOfQAbstractState>
pub unsafe fn from_list( list: impl CastInto<Ref<QListOfQAbstractState>> ) -> CppBox<QSetOfQAbstractState>
Returns a new QSet object containing the data contained in list. Since QSet doesn't allow duplicates, the resulting QSet might be smaller than the list, because QList can contain duplicates.
Calls C++ function: static QSet<QAbstractState*> QSet<QAbstractState*>::fromList(const QList<QAbstractState*>& list)
.
Returns a new QSet object containing the data contained in list. Since QSet doesn’t allow duplicates, the resulting QSet might be smaller than the list, because QList can contain duplicates.
Example:
QStringList list; list << “Julia” << “Mike” << “Mike” << “Julia” << “Julia”;
QSet<QString> set = QSet<QString>::fromList(list); set.contains(“Julia”); // returns true set.contains(“Mike”); // returns true set.size(); // returns 2
See also toList() and QList::toSet().
sourcepub unsafe fn insert(
&self,
value: *const *mut QAbstractState
) -> CppBox<Iterator>
pub unsafe fn insert( &self, value: *const *mut QAbstractState ) -> CppBox<Iterator>
Inserts item value into the set, if value isn't already in the set, and returns an iterator pointing at the inserted item.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::insert(const QAbstractState*& value)
.
Inserts item value into the set, if value isn’t already in the set, and returns an iterator pointing at the inserted item.
See also operator<<(), remove(), and contains().
sourcepub unsafe fn intersect(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn intersect( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Removes all items from this set that are not contained in the other set. A reference to this set is returned.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::intersect(const QSet<QAbstractState*>& other)
.
Removes all items from this set that are not contained in the other set. A reference to this set is returned.
See also intersects(), operator&=(), unite(), and subtract().
sourcepub unsafe fn intersects(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> bool
pub unsafe fn intersects( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> bool
Returns true
if this set has at least one item in common with other.
Calls C++ function: bool QSet<QAbstractState*>::intersects(const QSet<QAbstractState*>& other) const
.
sourcepub unsafe fn is_detached(&self) -> bool
pub unsafe fn is_detached(&self) -> bool
Calls C++ function: bool QSet<QAbstractState*>::isDetached() const
.
sourcepub unsafe fn is_empty(&self) -> bool
pub unsafe fn is_empty(&self) -> bool
Returns true
if the set contains no elements; otherwise returns false.
Calls C++ function: bool QSet<QAbstractState*>::isEmpty() const
.
Returns true
if the set contains no elements; otherwise returns false.
See also size().
sourcepub unsafe fn new() -> CppBox<QSetOfQAbstractState>
pub unsafe fn new() -> CppBox<QSetOfQAbstractState>
Constructs an empty set.
Calls C++ function: [constructor] void QSet<QAbstractState*>::QSet()
.
Constructs an empty set.
See also clear().
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> CppBox<QSetOfQAbstractState>
pub unsafe fn new_copy( other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> CppBox<QSetOfQAbstractState>
The QSet class is a template class that provides a hash-table-based set.
Calls C++ function: [constructor] void QSet<QAbstractState*>::QSet(const QSet<QAbstractState*>& other)
.
The QSet class is a template class that provides a hash-table-based set.
QSet<T> is one of Qt's generic container classes. It stores values in an unspecified order and provides very fast lookup of the values. Internally, QSet<T> is implemented as a QHash.
Here's an example QSet with QString values:
To insert a value into the set, use insert():
set.insert(“one”); set.insert(“three”); set.insert(“seven”);
Another way to insert items into the set is to use operator<<():
set << “twelve” << “fifteen” << “nineteen”;
To test whether an item belongs to the set or not, use contains():
if (!set.contains(“ninety-nine”)) ...
If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both Java-style iterators (QSetIterator and QMutableSetIterator) and STL-style iterators (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet<QWidget *> using a Java-style iterator:
QSetIterator<QWidget *> i(set); while (i.hasNext()) qDebug() << i.next();
Here's the same code, but using an STL-style iterator:
QSet<QWidget >::const_iterator i = set.constBegin(); while (i != set.constEnd()) { qDebug() << i; ++i; }
QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap.
To navigate through a QSet, you can also use foreach:
QSet<QString> set; ... foreach (const QString &value, set) qDebug() << value;
Items can be removed from the set using remove(). There is also a clear() function that removes all items.
QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide operator==()
, and there must also be a global qHash() function that returns a hash value for an argument of the key's type. See the QHash documentation for a list of types supported by qHash().
Internally, QSet uses a hash table to perform lookups. The hash table automatically grows and shrinks to provide fast lookups without wasting memory. You can still control the size of the hash table by calling reserve(), if you already know approximately how many elements the QSet will contain, but this isn't necessary to obtain good performance. You can also call capacity() to retrieve the hash table's size.
sourcepub unsafe fn remove(&self, value: *const *mut QAbstractState) -> bool
pub unsafe fn remove(&self, value: *const *mut QAbstractState) -> bool
Removes any occurrence of item value from the set. Returns true if an item was actually removed; otherwise returns false
.
Calls C++ function: bool QSet<QAbstractState*>::remove(const QAbstractState*& value)
.
sourcepub unsafe fn reserve(&self, size: c_int)
pub unsafe fn reserve(&self, size: c_int)
Ensures that the set's internal hash table consists of at least size buckets.
Calls C++ function: void QSet<QAbstractState*>::reserve(int size)
.
Ensures that the set’s internal hash table consists of at least size buckets.
This function is useful for code that needs to build a huge set and wants to avoid repeated reallocation. For example:
QSet<QString> set; set.reserve(20000); for (int i = 0; i < 20000; ++i) set.insert(values[i]);
Ideally, size should be slightly more than the maximum number of elements expected in the set. size doesn't have to be prime, because QSet will use a prime number internally anyway. If size is an underestimate, the worst that will happen is that the QSet will be a bit slower.
In general, you will rarely ever need to call this function. QSet's internal hash table automatically shrinks or grows to provide good performance without wasting too much memory.
sourcepub unsafe fn set_sharable(&self, sharable: bool)
pub unsafe fn set_sharable(&self, sharable: bool)
Calls C++ function: void QSet<QAbstractState*>::setSharable(bool sharable)
.
sourcepub unsafe fn size(&self) -> c_int
pub unsafe fn size(&self) -> c_int
Returns the number of items in the set.
Calls C++ function: int QSet<QAbstractState*>::size() const
.
sourcepub unsafe fn squeeze(&self)
pub unsafe fn squeeze(&self)
Reduces the size of the set's internal hash table to save memory.
Calls C++ function: void QSet<QAbstractState*>::squeeze()
.
sourcepub unsafe fn sub_assign_q_set_of_q_abstract_state(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn sub_assign_q_set_of_q_abstract_state( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Same as subtract(other).
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator-=(const QSet<QAbstractState*>& other)
.
Same as subtract(other).
See also operator-(), operator|=(), and operator&=().
sourcepub unsafe fn sub_assign_q_abstract_state(
&self,
value: *const *mut QAbstractState
) -> Ref<QSetOfQAbstractState>
pub unsafe fn sub_assign_q_abstract_state( &self, value: *const *mut QAbstractState ) -> Ref<QSetOfQAbstractState>
Removes the occurrence of item value from the set, if it is found, and returns a reference to the set. If the value is not contained the set, nothing is removed.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator-=(const QAbstractState*& value)
.
Removes the occurrence of item value from the set, if it is found, and returns a reference to the set. If the value is not contained the set, nothing is removed.
See also remove().
sourcepub unsafe fn subtract(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn subtract( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Removes all items from this set that are contained in the other set. Returns a reference to this set.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::subtract(const QSet<QAbstractState*>& other)
.
Removes all items from this set that are contained in the other set. Returns a reference to this set.
See also operator-=(), unite(), and intersect().
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QSetOfQAbstractState>>)
pub unsafe fn swap(&self, other: impl CastInto<Ref<QSetOfQAbstractState>>)
Swaps set other with this set. This operation is very fast and never fails.
Calls C++ function: void QSet<QAbstractState*>::swap(QSet<QAbstractState*>& other)
.
Swaps set other with this set. This operation is very fast and never fails.
sourcepub unsafe fn to_list(&self) -> CppBox<QListOfQAbstractState>
pub unsafe fn to_list(&self) -> CppBox<QListOfQAbstractState>
sourcepub unsafe fn unite(
&self,
other: impl CastInto<Ref<QSetOfQAbstractState>>
) -> Ref<QSetOfQAbstractState>
pub unsafe fn unite( &self, other: impl CastInto<Ref<QSetOfQAbstractState>> ) -> Ref<QSetOfQAbstractState>
Each item in the other set that isn't already in this set is inserted into this set. A reference to this set is returned.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::unite(const QSet<QAbstractState*>& other)
.
Each item in the other set that isn’t already in this set is inserted into this set. A reference to this set is returned.
See also operator|=(), intersect(), and subtract().
sourcepub unsafe fn values(&self) -> CppBox<QListOfQAbstractState>
pub unsafe fn values(&self) -> CppBox<QListOfQAbstractState>
Returns a new QList containing the elements in the set. The order of the elements in the QList is undefined.
Calls C++ function: QList<QAbstractState*> QSet<QAbstractState*>::values() const
.
Returns a new QList containing the elements in the set. The order of the elements in the QList is undefined.
This is the same as toList().
See also fromList() and QList::fromSet().
Trait Implementations§
source§impl Add<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
impl Add<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
source§fn add(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
fn add(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
Returns a new QSet that is the union of this set and the other set.
Calls C++ function: QSet<QAbstractState*> QSet<QAbstractState*>::operator+(const QSet<QAbstractState*>& other) const
.
Returns a new QSet that is the union of this set and the other set.
See also unite(), operator|=(), operator&(), and operator-().
§type Output = CppBox<QSetOfQAbstractState>
type Output = CppBox<QSetOfQAbstractState>
+
operator.source§impl Begin for QSetOfQAbstractState
impl Begin for QSetOfQAbstractState
source§unsafe fn begin(&self) -> CppBox<ConstIterator>
unsafe fn begin(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the first item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::begin() const
.
Returns a const STL-style iterator positioned at the first item in the set.
See also constBegin() and end().
§type Output = CppBox<ConstIterator>
type Output = CppBox<ConstIterator>
source§impl BeginMut for QSetOfQAbstractState
impl BeginMut for QSetOfQAbstractState
source§unsafe fn begin_mut(&self) -> CppBox<Iterator>
unsafe fn begin_mut(&self) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::begin()
.
This is an overloaded function.
Returns a non-const STL-style iterator positioned at the first item in the set.
This function was introduced in Qt 4.2.
source§impl BitAnd<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
impl BitAnd<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
source§fn bitand(
self,
other: Ref<QSetOfQAbstractState>
) -> CppBox<QSetOfQAbstractState>
fn bitand( self, other: Ref<QSetOfQAbstractState> ) -> CppBox<QSetOfQAbstractState>
Returns a new QSet that is the intersection of this set and the other set.
Calls C++ function: QSet<QAbstractState*> QSet<QAbstractState*>::operator&(const QSet<QAbstractState*>& other) const
.
Returns a new QSet that is the intersection of this set and the other set.
See also intersect(), operator&=(), operator|(), and operator-().
§type Output = CppBox<QSetOfQAbstractState>
type Output = CppBox<QSetOfQAbstractState>
&
operator.source§impl BitOr<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
impl BitOr<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
source§fn bitor(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
fn bitor(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
Returns a new QSet that is the union of this set and the other set.
Calls C++ function: QSet<QAbstractState*> QSet<QAbstractState*>::operator|(const QSet<QAbstractState*>& other) const
.
Returns a new QSet that is the union of this set and the other set.
See also unite(), operator|=(), operator&(), and operator-().
§type Output = CppBox<QSetOfQAbstractState>
type Output = CppBox<QSetOfQAbstractState>
|
operator.source§impl CppDeletable for QSetOfQAbstractState
impl CppDeletable for QSetOfQAbstractState
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QSet class is a template class that provides a hash-table-based set.
Calls C++ function: [destructor] void QSet<QAbstractState*>::~QSet()
.
The QSet class is a template class that provides a hash-table-based set.
QSet<T> is one of Qt's generic container classes. It stores values in an unspecified order and provides very fast lookup of the values. Internally, QSet<T> is implemented as a QHash.
Here's an example QSet with QString values:
To insert a value into the set, use insert():
set.insert(“one”); set.insert(“three”); set.insert(“seven”);
Another way to insert items into the set is to use operator<<():
set << “twelve” << “fifteen” << “nineteen”;
To test whether an item belongs to the set or not, use contains():
if (!set.contains(“ninety-nine”)) ...
If you want to navigate through all the values stored in a QSet, you can use an iterator. QSet supports both Java-style iterators (QSetIterator and QMutableSetIterator) and STL-style iterators (QSet::iterator and QSet::const_iterator). Here's how to iterate over a QSet<QWidget *> using a Java-style iterator:
QSetIterator<QWidget *> i(set); while (i.hasNext()) qDebug() << i.next();
Here's the same code, but using an STL-style iterator:
QSet<QWidget >::const_iterator i = set.constBegin(); while (i != set.constEnd()) { qDebug() << i; ++i; }
QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap.
To navigate through a QSet, you can also use foreach:
QSet<QString> set; ... foreach (const QString &value, set) qDebug() << value;
Items can be removed from the set using remove(). There is also a clear() function that removes all items.
QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide operator==()
, and there must also be a global qHash() function that returns a hash value for an argument of the key's type. See the QHash documentation for a list of types supported by qHash().
Internally, QSet uses a hash table to perform lookups. The hash table automatically grows and shrinks to provide fast lookups without wasting memory. You can still control the size of the hash table by calling reserve(), if you already know approximately how many elements the QSet will contain, but this isn't necessary to obtain good performance. You can also call capacity() to retrieve the hash table's size.
source§impl End for QSetOfQAbstractState
impl End for QSetOfQAbstractState
source§unsafe fn end(&self) -> CppBox<ConstIterator>
unsafe fn end(&self) -> CppBox<ConstIterator>
Returns a const STL-style iterator positioned at the imaginary item after the last item in the set.
Calls C++ function: QSet<QAbstractState*>::const_iterator QSet<QAbstractState*>::end() const
.
Returns a const STL-style iterator positioned at the imaginary item after the last item in the set.
§type Output = CppBox<ConstIterator>
type Output = CppBox<ConstIterator>
source§impl EndMut for QSetOfQAbstractState
impl EndMut for QSetOfQAbstractState
source§unsafe fn end_mut(&self) -> CppBox<Iterator>
unsafe fn end_mut(&self) -> CppBox<Iterator>
This is an overloaded function.
Calls C++ function: QSet<QAbstractState*>::iterator QSet<QAbstractState*>::end()
.
This is an overloaded function.
Returns a non-const STL-style iterator pointing to the imaginary item after the last item in the set.
This function was introduced in Qt 4.2.
source§impl PartialEq<Ref<QSetOfQAbstractState>> for QSetOfQAbstractState
impl PartialEq<Ref<QSetOfQAbstractState>> for QSetOfQAbstractState
source§fn eq(&self, other: &Ref<QSetOfQAbstractState>) -> bool
fn eq(&self, other: &Ref<QSetOfQAbstractState>) -> bool
Returns true
if the other set is equal to this set; otherwise returns false
.
Calls C++ function: bool QSet<QAbstractState*>::operator==(const QSet<QAbstractState*>& other) const
.
Returns true
if the other set is equal to this set; otherwise returns false
.
Two sets are considered equal if they contain the same elements.
This function requires the value type to implement operator==()
.
See also operator!=().
source§impl Shl<*const *mut QAbstractState> for &QSetOfQAbstractState
impl Shl<*const *mut QAbstractState> for &QSetOfQAbstractState
source§fn shl(self, value: *const *mut QAbstractState) -> Ref<QSetOfQAbstractState>
fn shl(self, value: *const *mut QAbstractState) -> Ref<QSetOfQAbstractState>
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
Calls C++ function: QSet<QAbstractState*>& QSet<QAbstractState*>::operator<<(const QAbstractState*& value)
.
Inserts a new item value and returns a reference to the set. If value already exists in the set, the set is left unchanged.
See also insert().
§type Output = Ref<QSetOfQAbstractState>
type Output = Ref<QSetOfQAbstractState>
<<
operator.source§impl Size for QSetOfQAbstractState
impl Size for QSetOfQAbstractState
source§impl Sub<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
impl Sub<Ref<QSetOfQAbstractState>> for &QSetOfQAbstractState
source§fn sub(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
fn sub(self, other: Ref<QSetOfQAbstractState>) -> CppBox<QSetOfQAbstractState>
Returns a new QSet that is the set difference of this set and the other set, i.e., this set - other set.
Calls C++ function: QSet<QAbstractState*> QSet<QAbstractState*>::operator-(const QSet<QAbstractState*>& other) const
.
Returns a new QSet that is the set difference of this set and the other set, i.e., this set - other set.
See also subtract(), operator-=(), operator|(), and operator&().
§type Output = CppBox<QSetOfQAbstractState>
type Output = CppBox<QSetOfQAbstractState>
-
operator.