Please - explain the purpose of highlighted code
-
I am posting this to gain understanding of the purpose of highlighted code.
This is taken from QT doc on how to pass parameters to QtConncurrent :run function.I do not need any more instruction - just answer to this question.
Reference to document would be nice - QT doc does not say why it is necessary.
I can "pass " int integer = xxx; however I do not know how to pass a pointer.
For example "struct ptr ??? " .extern void aFunctionWithArguments(int arg1, double arg2, const QString &string); **int integer = ...; double floatingPoint = ...; QString string = ...;** QFuture<void> future = QtConcurrent::run(aFunctionWithArguments, integer, floatingPoint, string);
-
@AnneRanch said in Please - explain the purpose of highlighted code:
I am posting this to gain understanding of the purpose of highlighted code.
When you say "highlighted code", do you mean the part that you wrapped in
**
...**
symbols?Its purpose is to store values inside variables. That's all.
QT doc does not say why it is necessary.
It is not necessary, it is just very common.
This code:
int integer = 12; double floatingPoint = 3.4; QString string = "Fifty-six"; QFuture<void> future = QtConcurrent::run(aFunctionWithArguments, integer, floatingPoint, string);
...does exactly the same thing as this code:
QFuture<void> future = QtConcurrent::run(aFunctionWithArguments, 12, 3.4, "Fifty-six");
I can "pass " int integer = xxx; however I do not know how to pass a pointer.
You must first write a function that accepts a pointer as a parameter.