[−][src]Struct qt_widgets::q_map_of_gesture_type_bool::KeyIterator
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
C++ class: QMap<Qt::GestureType, bool>::key_iterator
.
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
QMap::key_iterator is essentially the same as QMap::const_iterator with the difference that operator*() and operator->() return a key instead of a value.
For most uses QMap::iterator and QMap::const_iterator should be used, you can easily access the key by calling QMap::iterator::key():
for (QMap<int, QString>::const_iterator it = map.cbegin(), end = map.cend(); it != end; ++it) { cout << "The key: " << it.key() << endl cout << "The value: " << it.value() << endl; cout << "Also the value: " << (*it) << endl; }
However, to have interoperability between QMap's keys and STL-style algorithms we need an iterator that dereferences to a key instead of a value. With QMap::key_iterator we can apply an algorithm to a range of keys without having to call QMap::keys(), which is inefficient as it costs one QMap iteration and memory allocation to create a temporary QList.
// Inefficient, keys() is expensive QList<int> keys = map.keys(); int numPrimes = std::count_if(map.cbegin(), map.cend(), isPrimeNumber); qDeleteAll(map2.keys());
// Efficient, no memory allocation needed int numPrimes = std::count_if(map.keyBegin(), map.keyEnd(), isPrimeNumber); qDeleteAll(map2.keyBegin(), map2.keyEnd());
QMap::key_iterator is const, it's not possible to modify the key.
The default QMap::key_iterator constructor creates an uninitialized iterator. You must initialize it using a QMap function like QMap::keyBegin() or QMap::keyEnd().
Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.
Methods
impl KeyIterator
[src]
pub unsafe fn base(&self) -> CppBox<ConstIterator>
[src]
Returns the underlying const_iterator this key_iterator is based on.
Calls C++ function: QMap<Qt::GestureType, bool>::const_iterator QMap<Qt::GestureType, bool>::key_iterator::base() const
.
Returns the underlying const_iterator this key_iterator is based on.
pub unsafe fn copy_from(
&mut self,
other: impl CastInto<Ref<KeyIterator>>
) -> MutRef<KeyIterator>
[src]
&mut self,
other: impl CastInto<Ref<KeyIterator>>
) -> MutRef<KeyIterator>
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
Calls C++ function: QMap<Qt::GestureType, bool>::key_iterator& QMap<Qt::GestureType, bool>::key_iterator::operator=(const QMap<Qt::GestureType, bool>::key_iterator& other)
.
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
QMap::key_iterator is essentially the same as QMap::const_iterator with the difference that operator*() and operator->() return a key instead of a value.
For most uses QMap::iterator and QMap::const_iterator should be used, you can easily access the key by calling QMap::iterator::key():
for (QMap<int, QString>::const_iterator it = map.cbegin(), end = map.cend(); it != end; ++it) { cout << "The key: " << it.key() << endl cout << "The value: " << it.value() << endl; cout << "Also the value: " << (*it) << endl; }
However, to have interoperability between QMap's keys and STL-style algorithms we need an iterator that dereferences to a key instead of a value. With QMap::key_iterator we can apply an algorithm to a range of keys without having to call QMap::keys(), which is inefficient as it costs one QMap iteration and memory allocation to create a temporary QList.
// Inefficient, keys() is expensive QList<int> keys = map.keys(); int numPrimes = std::count_if(map.cbegin(), map.cend(), isPrimeNumber); qDeleteAll(map2.keys());
// Efficient, no memory allocation needed int numPrimes = std::count_if(map.keyBegin(), map.keyEnd(), isPrimeNumber); qDeleteAll(map2.keyBegin(), map2.keyEnd());
QMap::key_iterator is const, it's not possible to modify the key.
The default QMap::key_iterator constructor creates an uninitialized iterator. You must initialize it using a QMap function like QMap::keyBegin() or QMap::keyEnd().
Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.
pub unsafe fn dec_postfix(&mut self, arg1: c_int) -> CppBox<KeyIterator>
[src]
This is an overloaded function.
Calls C++ function: QMap<Qt::GestureType, bool>::key_iterator QMap<Qt::GestureType, bool>::key_iterator::operator--(int arg1)
.
This is an overloaded function.
The postfix -- operator (i--
) makes the preceding item current and returns an iterator pointing to the previous item.
pub unsafe fn inc_postfix(&mut self, arg1: c_int) -> CppBox<KeyIterator>
[src]
This is an overloaded function.
Calls C++ function: QMap<Qt::GestureType, bool>::key_iterator QMap<Qt::GestureType, bool>::key_iterator::operator++(int arg1)
.
This is an overloaded function.
The postfix ++ operator (i++
) advances the iterator to the next item in the hash and returns an iterator to the previous item.
pub unsafe fn new_0a() -> CppBox<KeyIterator>
[src]
Default constructs an instance of key_iterator.
Calls C++ function: [constructor] void QMap<Qt::GestureType, bool>::key_iterator::key_iterator()
.
Default constructs an instance of key_iterator.
pub unsafe fn new_1a(
o: impl CastInto<Ref<ConstIterator>>
) -> CppBox<KeyIterator>
[src]
o: impl CastInto<Ref<ConstIterator>>
) -> CppBox<KeyIterator>
Calls C++ function: [constructor] void QMap<Qt::GestureType, bool>::key_iterator::key_iterator(QMap<Qt::GestureType, bool>::const_iterator o)
.
pub unsafe fn new_copy(
other: impl CastInto<Ref<KeyIterator>>
) -> CppBox<KeyIterator>
[src]
other: impl CastInto<Ref<KeyIterator>>
) -> CppBox<KeyIterator>
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
Calls C++ function: [constructor] void QMap<Qt::GestureType, bool>::key_iterator::key_iterator(const QMap<Qt::GestureType, bool>::key_iterator& other)
.
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
QMap::key_iterator is essentially the same as QMap::const_iterator with the difference that operator*() and operator->() return a key instead of a value.
For most uses QMap::iterator and QMap::const_iterator should be used, you can easily access the key by calling QMap::iterator::key():
for (QMap<int, QString>::const_iterator it = map.cbegin(), end = map.cend(); it != end; ++it) { cout << "The key: " << it.key() << endl cout << "The value: " << it.value() << endl; cout << "Also the value: " << (*it) << endl; }
However, to have interoperability between QMap's keys and STL-style algorithms we need an iterator that dereferences to a key instead of a value. With QMap::key_iterator we can apply an algorithm to a range of keys without having to call QMap::keys(), which is inefficient as it costs one QMap iteration and memory allocation to create a temporary QList.
// Inefficient, keys() is expensive QList<int> keys = map.keys(); int numPrimes = std::count_if(map.cbegin(), map.cend(), isPrimeNumber); qDeleteAll(map2.keys());
// Efficient, no memory allocation needed int numPrimes = std::count_if(map.keyBegin(), map.keyEnd(), isPrimeNumber); qDeleteAll(map2.keyBegin(), map2.keyEnd());
QMap::key_iterator is const, it's not possible to modify the key.
The default QMap::key_iterator constructor creates an uninitialized iterator. You must initialize it using a QMap function like QMap::keyBegin() or QMap::keyEnd().
Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.
pub unsafe fn struct_deref(&self) -> Ptr<GestureType>
[src]
Returns a pointer to the current item's key.
Calls C++ function: const Qt::GestureType* QMap<Qt::GestureType, bool>::key_iterator::operator->() const
.
Returns a pointer to the current item's key.
Trait Implementations
impl PartialEq<Ref<KeyIterator>> for KeyIterator
[src]
fn eq(&self, o: &Ref<KeyIterator>) -> bool
[src]
Returns true
if other points to the same item as this iterator; otherwise returns false
.
Calls C++ function: bool QMap<Qt::GestureType, bool>::key_iterator::operator==(QMap<Qt::GestureType, bool>::key_iterator o) const
.
Returns true
if other points to the same item as this iterator; otherwise returns false
.
See also operator!=().
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl CppDeletable for KeyIterator
[src]
unsafe fn delete(&mut self)
[src]
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
Calls C++ function: [destructor] void QMap<Qt::GestureType, bool>::key_iterator::~key_iterator()
.
The QMap::key_iterator class provides an STL-style const iterator for QMap and QMultiMap keys.
QMap::key_iterator is essentially the same as QMap::const_iterator with the difference that operator*() and operator->() return a key instead of a value.
For most uses QMap::iterator and QMap::const_iterator should be used, you can easily access the key by calling QMap::iterator::key():
for (QMap<int, QString>::const_iterator it = map.cbegin(), end = map.cend(); it != end; ++it) { cout << "The key: " << it.key() << endl cout << "The value: " << it.value() << endl; cout << "Also the value: " << (*it) << endl; }
However, to have interoperability between QMap's keys and STL-style algorithms we need an iterator that dereferences to a key instead of a value. With QMap::key_iterator we can apply an algorithm to a range of keys without having to call QMap::keys(), which is inefficient as it costs one QMap iteration and memory allocation to create a temporary QList.
// Inefficient, keys() is expensive QList<int> keys = map.keys(); int numPrimes = std::count_if(map.cbegin(), map.cend(), isPrimeNumber); qDeleteAll(map2.keys());
// Efficient, no memory allocation needed int numPrimes = std::count_if(map.keyBegin(), map.keyEnd(), isPrimeNumber); qDeleteAll(map2.keyBegin(), map2.keyEnd());
QMap::key_iterator is const, it's not possible to modify the key.
The default QMap::key_iterator constructor creates an uninitialized iterator. You must initialize it using a QMap function like QMap::keyBegin() or QMap::keyEnd().
Warning: Iterators on implicitly shared containers do not work exactly like STL-iterators. You should avoid copying a container while iterators are active on that container. For more information, read Implicit sharing iterator problem.
impl<'_> Decrement for &'_ mut KeyIterator
[src]
type Output = MutRef<KeyIterator>
Output type.
fn dec(self) -> MutRef<KeyIterator>
[src]
The prefix -- operator (--i
) makes the preceding item current and returns an iterator pointing to the new current item.
Calls C++ function: QMap<Qt::GestureType, bool>::key_iterator& QMap<Qt::GestureType, bool>::key_iterator::operator--()
.
The prefix -- operator (--i
) makes the preceding item current and returns an iterator pointing to the new current item.
Calling this function on QHash::keyBegin() leads to undefined results.
See also operator++().
impl<'_> Indirection for &'_ KeyIterator
[src]
type Output = Ref<GestureType>
Output type.
fn indirection(self) -> Ref<GestureType>
[src]
Returns the current item's key.
Calls C++ function: const Qt::GestureType& QMap<Qt::GestureType, bool>::key_iterator::operator*() const
.
Returns the current item's key.
impl<'_> Increment for &'_ mut KeyIterator
[src]
type Output = MutRef<KeyIterator>
Output type.
fn inc(self) -> MutRef<KeyIterator>
[src]
The prefix ++ operator (++i
) advances the iterator to the next item in the hash and returns an iterator to the new current item.
Calls C++ function: QMap<Qt::GestureType, bool>::key_iterator& QMap<Qt::GestureType, bool>::key_iterator::operator++()
.
The prefix ++ operator (++i
) advances the iterator to the next item in the hash and returns an iterator to the new current item.
Calling this function on QHash::keyEnd() leads to undefined results.
See also operator--().
Auto Trait Implementations
impl Send for KeyIterator
impl Unpin for KeyIterator
impl Sync for KeyIterator
impl UnwindSafe for KeyIterator
impl RefUnwindSafe for KeyIterator
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
unsafe fn static_upcast_mut(ptr: MutPtr<T>) -> MutPtr<T>
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,