Yes, it would work to specify the values one at a time, the problem is that I would like to copy all of the values from myVar2 to myVar1, which means I need to write
myVar1.name = myVar2.name;
myVar1.target = myVar2.target;
myVar1.size = myVar2.size;
etc. etc. etc.
which is not only annoying, but is error-prone and violates several object-oriented design principles.
And yes, Qml and JavaCcript are interpreted and C++ is compiled, the problem is that the interpreter doesn’t give me warnings or errors ever – including when the program is running and the Qml is interpreted and executed.
I realize that JavaScript doesn’t really support copying of objects by value, I’m working around this limitation in the language, my concern I guess is that by JavaScript rules, if I say
myVar1 = myVar2;
it should make myVar1 refer to the same object as myVar2 but that isn’t happening, and no errors or warnings are being generated.
↧