Hi there,

on my gui I show a 3D model of a skeleton and around the skeleton I have approx. 20 QDoubleSpinBoxes that show the angles of the joints of the skeleton. I animate the 3D model by setting new joint angles every 12 ms. It works great. I can see a smooth animation and my CPU still can breathe.

Now when I try to use the QDoubleSpinBoxes to display the actual numbers of the joint angles, my CPU almost dies and nothing moves. Here is what I do:

Qt Code:
  1. void transferAnglesToSpinboxes()
  2. {
  3. disconnect(this, SIGNAL(inputValueChanged()), this, SLOT(jointAnglesChangedBySpinbox()));
  4.  
  5. headY->setValue(jointAngles["headY"]);
  6. headZ->setValue(jointAngles["headZ"]);
  7. rShouX->setValue(jointAngles["rShouX"]);
  8. rShouY->setValue(jointAngles["rShouY"]);
  9. rShouZ->setValue(jointAngles["rShouZ"]);
  10. rElbow->setValue(jointAngles["rElbow"]);
  11. rHipX->setValue(jointAngles["rHipX"]);
  12. rHipY->setValue(jointAngles["rHipY"]);
  13. rHipZ->setValue(jointAngles["rHipZ"]);
  14. rKnee->setValue(jointAngles["rKnee"]);
  15. rAnkX->setValue(jointAngles["rAnkX"]);
  16. rAnkY->setValue(jointAngles["rAnkY"]);
  17. lShouX->setValue(jointAngles["lShouX"]);
  18. lShouY->setValue(jointAngles["lShouY"]);
  19. lShouZ->setValue(jointAngles["lShouZ"]);
  20. lElbow->setValue(jointAngles["lElbow"]);
  21. lHipX->setValue(jointAngles["lHipX"]);
  22. lHipY->setValue(jointAngles["lHipY"]);
  23. lHipZ->setValue(jointAngles["lHipZ"]);
  24. lKnee->setValue(jointAngles["lKnee"]);
  25. lAnkX->setValue(jointAngles["lAnkX"]);
  26. lAnkY->setValue(jointAngles["lAnkY"]);
  27.  
  28. connect(this, SIGNAL(inputValueChanged()), this, SLOT(jointAnglesChangedBySpinbox()));
  29. }
To copy to clipboard, switch view to plain text mode 

Those are lots of setValue() calls to different spin boxes. The valueChanged() signals of all those QDoubleSpinBoxes are connected to a single inputValueChanged() signal, that I disconnect prior to copying the jointAngles hash into the QDoubleSpinBoxes and then I reconnect the signal again. I do this to suppress the valueChanged() signals that I only want to deal with, when the spin boxes were changed manually and not programatically.

I isolated the update of the 3D model and the update of the spin boxes and I'm absolutely positive, that it's the setValue() calls that strain the CPU. The 3D model alone works fine, the spin boxes alone fry my machine.

I don't understand. The calculation of a new pose of the skeleton for a given set of joint angles is actually quite heavy math, but obviously well manageable in 12 ms. But 20 setValue() calls are too much? Why why why?