[resolved]Error with Q_ARG macro
I have code that is using QMetaObject::invoke to invoke a method. As at compile time I do not know how many arguments (or which method) will be invoked, I use a QGenericArgument array, and then call invoke with the populated array like so:
@invoke(instance Qt::DirectConnection, argumentTable, argumentTable, ...@
This works if two consecutive arguments are not of the same type. If two consecutive arguments are of the same type, the previous is replaced with the last. So if 0 & 1 are of type QString and int, the call works. However, if 0 & 1 are both of QString (yes, these would be two different methods), and 0 =="A" & 1=="B", then both values end up "B".
I understand my explanation is confusing. Please see code at:
You can see in the code about that how the variables are set. You can also see my qDebug statements. Here is some output:
When the two adjacent arguments are of different type:
Processed QString "qaz" at index 2
Processed int 3 at index 3
And when they are of the same type:
Processed QString "2" at index 2
Processed QString "3" at index 3
So you can see that when the argument is set, the index are correct, and the values are indeed different. But the pointers end up being the same in the second case.
Am I doing something incorrectly, or is this a defect in Qt?
For this output, the test code is at:
I'd appreciate any input.
This was a variable scope issue.