[solved] Pass fixed-size Eigen object as parameters in signals-slots function
I need to pass a "fixed-size vectorizable Eigen types":http://eigen.tuxfamily.org/dox/group__TopicFixedSizeVectorizable.html in Qt signals and slots function.
Note that the signals and the corresponding slots function is run in different threads which require QueuedConnection. Therefore, the parameters pass in the signal function are copied. Please see this "link":http://qt-project.org/wiki/ThreadsEventsQObjects for details
The Qt states that the parameters can be passed by value or const reference and the signals-slots will decide if a copy is required based on the connection type (QueuedConnection/DirectConnection).
However, Eigen states that the Eigen object must be passed by reference otherwise it is illegal or the program may crash (in my case: I got compilation errors for the alignment issue). For more details please see here: "link":http://eigen.tuxfamily.org/dox/group__TopicPassingByValue.html
If I passed the Eigen object by const reference and registered the Eigen object using qRegisterMetaType() before the connect() for signals-slots, I got compilation error as well. The error looks like:
__actual parameter with declspec(align('16')) won't be aligned
My environment: Win7 64bit - VS2010 - Qt 5.3.1 - Eigen 3.2.4
Has anyone passed Eigen object as parameter in the Qt signals-slots function? How did you do that.
Thanks very much,
I also wrote a wrapper class which contains the Eigen object according to the requirement "here":http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html. Unfortunately, same error.
The issue has been solved. Please see here:
Hi and welcome to devnet,
Glad you found a solution and thank for sharing !
Can you also please update the thread title prepending [solved] ? So other forum users may know a solution has been found :)