이 페이지에서

변경 사항 Qt Concurrent

Qt 6의 변경 사항은 프레임워크를 더욱 효율적이고 사용하기 쉽게 만들기 위한 의도적인 노력의 결과입니다.

저희는 각 릴리스에서 모든 공개 API에 대해 바이너리 및 소스 호환성을 유지하기 위해 노력하고 있습니다. 하지만 Qt를 더 나은 프레임워크로 만들기 위한 노력의 일환으로 일부 변경 사항은 불가피했습니다.

이 주제에서는 Qt Concurrent 의 변경 사항을 요약하고, 이를 처리하기 위한 지침을 제공합니다.

QtConcurrent::run()

QtConcurrent::run()은 가변 개수의 인자를 처리할 수 있도록 개선되었으므로, 시그니처가 다음과 같이 변경되었습니다.

// run
template <typename T>
QFuture<T> run(Function &&f, Args &&...args)

// run with a QThreadPool argument
template <typename T>
QFuture<T> run(QThreadPool *pool, Function &&f, Args &&...args)

부수적인 효과로, ` f `가 멤버 함수에 대한 포인터인 경우, ` args `의 첫 번째 인수는 해당 멤버가 정의된 객체(또는 참조, 혹은 그 객체에 대한 포인터)여야 합니다. 따라서 다음과 같이 작성하는 대신:

QImage image = ...;
QFuture<void> future = QtConcurrent::run(&image, &QImage::invertPixels, QImage::InvertRgba);

다음과 같이 작성해야 합니다:

QFuture<void> future = QtConcurrent::run(&QImage::invertPixels, &image, QImage::InvertRgba);

또 다른 부작용은 ` QtConcurrent::run() `이 더 이상 오버로드된 함수와 함께 작동하지 않는다는 점입니다. 예를 들어, 아래 코드는 컴파일되지 않습니다:

void foo(int arg);
void foo(int arg1, int arg2);
...
QFuture<void> future = QtConcurrent::run(foo, 42);

가장 쉬운 해결 방법은 람다를 통해 오버로드된 함수를 호출하는 것입니다:

QFuture<void> future = QtConcurrent::run([] { foo(42); });

또는 ` static_cast`를 사용하여 컴파일러에 어떤 오버로드 버전을 선택해야 하는지 지정할 수도 있습니다:

QFuture<void> future = QtConcurrent::run(static_cast<void(*)(int)>(foo), 42);

또는 ` qOverload`를 사용할 수도 있습니다:

QFuture<void> future = QtConcurrent::run(qOverload<int>(foo), 42);

QtConcurrent 의 다른 메서드들은 동작에 변화가 없으며, 소스 호환성 문제를 일으키지 않습니다.

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