Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QScript add a specific == operator
mistralegna last edited by
I am currently playing with the functionalities provided by the QScript module. I would like to evaluate a simple expression like 'val 1' == 'val 2'. Is it possible to indicate to QScript what it should use to perform the equality comparison ? In C++, I should have reimplemented the operator== for the specified types.
Thanks a lot for your answers !
SysTech last edited by SysTech
I honestly can't answer your question directly as I have not tried to do any operator overloading in QScript. I can say however while it is not the same thing you can extend QScript providing and registering your own functions. So you can have something in your code like:
if( compareValue( A, B ) ) then do something
You'd write and register compareValue to do whatever you need. Yes yes... not operator overloading but it would world to get your comparison to work the way you want. I'm doing something like this now in my scripts.