IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QTaskBuilder Class

The QTaskBuilder class is used for adjusting task parameters.

This class was introduced in Qt 6.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QTaskBuilder Class

  • Header: QTaskBuilder

  • Since: Qt 6.0

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Concurrent)

    target_link_libraries(mytarget PRIVATE Qt6::Concurrent)

  • qmake: QT += concurrent

  • Group: QTaskBuilder is part of thread

Detailed Description

It's not possible to create an object of this class manually. See Concurrent Task for more details and usage examples.

Member Function Documentation

 

QTaskBuilder<Task, Args...> &QTaskBuilder::onThreadPool(QThreadPool &newThreadPool)

Sets the thread pool newThreadPool that the task will be invoked on.

QFuture<QtConcurrent::InvokeResultType> QTaskBuilder::spawn()

Runs the task in a separate thread and returns a future object immediately. This is a non-blocking call. The task might not start immediately.

void QTaskBuilder::spawn(QtConcurrent::FutureResult)

Runs the task in a separate thread. This is a non-blocking call. The task might not start immediately.

QTaskBuilder<Task, ExtraArgs...> QTaskBuilder::withArguments(ExtraArgs &&... args)

Sets the arguments args the task will be invoked with. The code is ill-formed (causes compilation errors) if:

  • This function is invoked more than once.

  • The arguments count is zero.

QTaskBuilder<Task, Args...> &QTaskBuilder::withPriority(int newPriority)

Sets the priority newPriority that the task will be invoked with.

Related Non-Members

 

[alias] InvokeResultType

The simplified definition of this type looks like this:

 
Sélectionnez
template &lt;class Task, class ...Args&gt;
using InvokeResultType = std::invoke_result_t&lt;std::decay_t&lt;Task&gt;, std::decay_t&lt;Args&gt;...&gt;;

The real implementation also contains a compile-time check for whether the task can be invoked with the specified arguments or not.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+