Quote Originally Posted by anda_skoa View Post
Why don't you create and calculate in C++ directly?
This question does not make much sense to me.

I have a GUI designed in QML. User is supposed to fill in some values there.
I am supposed to calculate something from those values and then pass them to C++ so that they can be used
in an algorithm.

You think this kind of problem cannot exist in a properly designed program?

Anyways,

I have found a temporary solution as follows:

One way to add the values dynamically to a 1 dimensional QML variant is to fill a normal Javascript array and then assign it to the QML variant.
Qt Code:
  1. import QtQuick 2.0
  2.  
  3. Rectangle
  4. {
  5. property variant oneDArray: []
  6. MouseArea
  7. {
  8. anchors.fill: parent
  9. onClicked:
  10. {
  11. var t = new Array (0)
  12. t.push(11)
  13. t.push(12)
  14.  
  15. oneDArray = t
  16.  
  17. console.log (oneDArray)
  18. }
  19. }
  20. }
To copy to clipboard, switch view to plain text mode 

Output:
Qt Code:
  1. Starting /home/.../documents/test/build-junk-Desktop_Qt_5_1_0_GCC_64bit-Debug/junk...
  2. QML debugging is enabled. Only use this in a safe environment.
  3. [11,12]
  4. /home/.../documents/test/build-junk-Desktop_Qt_5_1_0_GCC_64bit-Debug/junk exited with code 0
To copy to clipboard, switch view to plain text mode