이 페이지에서

QMetaAssociation::Iterable::ConstIterator Class

class QMetaAssociation::Iterable::ConstIterator

QMetaAssociation::Iterable::ConstIterator 에서 컨테이너에 대한 반복을 허용합니다 QVariant.. . 더보기...

이 클래스는 Qt 6.11에 도입되었습니다.

공용 함수

QVariant key() const
QVariant value() const
QVariant operator*() const
int operator->() const

상세 설명

QMetaAssociation::Iterable::ConstIterator 인스턴스는 QMetaAssociation::Iterable 인스턴스만 만들 수 있으며 다른 stl 스타일 이터레이터와 유사한 방식으로 사용할 수 있습니다.

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>()) { QMetaAssociation::이터러블 이터러블 = variant.value<QMetaAssociation::Iterable>(); // 값 위에 C++11 범위-포 사용 가능: for(const QVariant &v: 이터러블) {        qDebug() << v;
    } // 이터레이터를 사용할 수 있습니다:    QMetaAssociation::Iterable::const_iterator it = iterable.begin(); const QMetaAssociation::Iterable::const_iterator end = iterable.end(); for ( ; it != end; ++it) {        qDebug() << *it; // The current value
        qDebug() << it.key();
        qDebug() << it.value();
    } }

QMetaAssociation::Iterable도 참조하세요 .

멤버 함수 문서

QVariant ConstIterator::key() const

이터레이터가 가리키는 키를 반환합니다.

QVariant ConstIterator::value() const

이 이터레이터가 가리키는 매핑된 값을 반환하거나 매핑된 값이 없는 경우 잘못된 QVariant 을 반환합니다.

QVariant ConstIterator::operator*() const

현재 항목을 QVariant 로 변환하여 반환합니다. 반환되는 값은 현재 반복기가 있는 경우 현재 반복기에 매핑된 값이고, 그렇지 않으면 키입니다.

int ConstIterator::operator->() const

현재 항목을 QVariant::ConstPointer 로 변환하여 반환합니다. QVariant::ConstPointer 은 현재 반복자가 있는 경우 매핑된 값으로, 그렇지 않은 경우 키로 확인합니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.