<QForeach> 프록시 페이지

매크로

Q_FOREACH(variable, container)
Q_FOREVER
foreach(variable, container)
forever

매크로 문서

Q_FOREACH(variable, container)

foreach(variable, container)와 동일합니다.

이 매크로는 .pro 파일의 CONFIG 변수를 사용하여 no_keywords 을 지정한 경우에도 사용할 수 있습니다.

참고: Qt 5.7부터는 이 매크로의 사용을 권장하지 않습니다. 필요에 따라 C++11 범위 기반 for, 또는 std::as_const() 을 사용하세요.

Q_FOREVER

forever 과 동일합니다.

이 매크로는 .pro 파일의 CONFIG 변수를 사용하여 no_keywords 을 지정한 경우에도 사용할 수 있습니다.

foreach()도 참조하세요 .

foreach(variable, container)

이 매크로는 Qt의 foreach 루프를 구현하는 데 사용됩니다. variable 매개변수는 변수 이름 또는 변수 정의이고, container 매개변수는 변수 유형에 해당하는 값 타입을 가진 Qt 컨테이너입니다. 자세한 내용은 foreach 키워드를 참조하십시오.

네임스페이스 오염이 걱정된다면 .pro 파일에 다음 줄을 추가하여 이 매크로를 비활성화할 수 있습니다:

CONFIG += no_keywords

참고: Qt 5.7부터는 이 매크로의 사용을 권장하지 않습니다. 필요에 따라 C++11 범위 기반 for, 또는 std::as_const() 을 사용하세요.

forever

이 매크로는 무한 루프 작성 시 편의를 위해 제공됩니다.

예시:

forever {
    ...
}

for (;;) 에 해당합니다.

네임스페이스 오염이 걱정된다면 .pro 파일에 다음 줄을 추가하여 이 매크로를 비활성화할 수 있습니다:

CONFIG += no_keywords

다른 빌드 시스템을 사용하는 경우 미리 정의된 매크로 목록에 QT_NO_KEYWORDS 을 추가할 수 있습니다.

Q_FOREVER참조하세요 .

© 2025 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.