[][src]Struct qt_core::QAssociativeIterable

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

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

C++ class: QAssociativeIterable.

C++ documentation:

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

This class allows several methods of accessing the elements of an associative container held within a QVariant. An instance of QAssociativeIterable can be extracted from a QVariant if it can be converted to a QVariantHash or QVariantMap.

QHash<int, QString> mapping; mapping.insert(7, "Seven"); mapping.insert(11, "Eleven"); mapping.insert(42, "Forty-two");

QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use foreach over the values: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for over the values: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; // The current value qDebug() << it.key(); qDebug() << it.value(); } }

The container itself is not copied before iterating over it.

Methods

impl QAssociativeIterable[src]

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

Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration.

Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::begin() const.

C++ documentation:

Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration.

See also end().

pub unsafe fn copy_from(
    &mut self,
    other: impl CastInto<Ref<QAssociativeIterable>>
) -> MutRef<QAssociativeIterable>
[src]

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

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

C++ documentation:

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

This class allows several methods of accessing the elements of an associative container held within a QVariant. An instance of QAssociativeIterable can be extracted from a QVariant if it can be converted to a QVariantHash or QVariantMap.

QHash<int, QString> mapping; mapping.insert(7, "Seven"); mapping.insert(11, "Eleven"); mapping.insert(42, "Forty-two");

QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use foreach over the values: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for over the values: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; // The current value qDebug() << it.key(); qDebug() << it.value(); } }

The container itself is not copied before iterating over it.

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

Returns a QAssociativeIterable::const_iterator for the end of the container. This can be used in stl-style iteration.

Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::end() const.

C++ documentation:

Returns a QAssociativeIterable::const_iterator for the end of the container. This can be used in stl-style iteration.

See also begin().

pub unsafe fn find(
    &self,
    key: impl CastInto<Ref<QVariant>>
) -> CppBox<ConstIterator>
[src]

Returns a QAssociativeIterable::const_iterator for the given key key in the container, if the types are convertible.

Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::find(const QVariant& key) const.

C++ documentation:

Returns a QAssociativeIterable::const_iterator for the given key key in the container, if the types are convertible.

If the key is not found, returns end().

This can be used in stl-style iteration.

This function was introduced in Qt 5.5.

See also begin(), end(), and value().

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

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

Calls C++ function: [constructor] void QAssociativeIterable::QAssociativeIterable(const QAssociativeIterable& other).

C++ documentation:

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

This class allows several methods of accessing the elements of an associative container held within a QVariant. An instance of QAssociativeIterable can be extracted from a QVariant if it can be converted to a QVariantHash or QVariantMap.

QHash<int, QString> mapping; mapping.insert(7, "Seven"); mapping.insert(11, "Eleven"); mapping.insert(42, "Forty-two");

QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use foreach over the values: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for over the values: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; // The current value qDebug() << it.key(); qDebug() << it.value(); } }

The container itself is not copied before iterating over it.

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

Returns the number of elements in the container.

Calls C++ function: int QAssociativeIterable::size() const.

C++ documentation:

Returns the number of elements in the container.

pub unsafe fn value(
    &self,
    key: impl CastInto<Ref<QVariant>>
) -> CppBox<QVariant>
[src]

Returns the value for the given key in the container, if the types are convertible.

Calls C++ function: QVariant QAssociativeIterable::value(const QVariant& key) const.

C++ documentation:

Returns the value for the given key in the container, if the types are convertible.

See also find().

Trait Implementations

impl CppDeletable for QAssociativeIterable[src]

unsafe fn delete(&mut self)[src]

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

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

C++ documentation:

The QAssociativeIterable class is an iterable interface for an associative container in a QVariant.

This class allows several methods of accessing the elements of an associative container held within a QVariant. An instance of QAssociativeIterable can be extracted from a QVariant if it can be converted to a QVariantHash or QVariantMap.

QHash<int, QString> mapping; mapping.insert(7, "Seven"); mapping.insert(11, "Eleven"); mapping.insert(42, "Forty-two");

QVariant variant = QVariant::fromValue(mapping); if (variant.canConvert<QVariantHash>()) { QAssociativeIterable iterable = variant.value<QAssociativeIterable>(); // Can use foreach over the values: foreach (const QVariant &v, iterable) { qDebug() << v; } // Can use C++11 range-for over the values: for (const QVariant &v : iterable) { qDebug() << v; } // Can use iterators: QAssociativeIterable::const_iterator it = iterable.begin(); const QAssociativeIterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) { qDebug() << *it; // The current value qDebug() << it.key(); qDebug() << it.value(); } }

The container itself is not copied before iterating over it.

impl Begin for QAssociativeIterable[src]

type Output = CppBox<ConstIterator>

Output type.

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

Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration.

Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::begin() const.

C++ documentation:

Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration.

See also end().

impl End for QAssociativeIterable[src]

type Output = CppBox<ConstIterator>

Output type.

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

Returns a QAssociativeIterable::const_iterator for the end of the container. This can be used in stl-style iteration.

Calls C++ function: QAssociativeIterable::const_iterator QAssociativeIterable::end() const.

C++ documentation:

Returns a QAssociativeIterable::const_iterator for the end of the container. This can be used in stl-style iteration.

See also begin().

impl Size for QAssociativeIterable[src]

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

Returns the number of elements in the container.

Calls C++ function: int QAssociativeIterable::size() const.

C++ documentation:

Returns the number of elements in the container.

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<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.

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

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

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

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

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