1. Declare function:

Qt Code:
  1. void setItemColor(int red, int green, int blue, int alpha);
To copy to clipboard, switch view to plain text mode 

as a public slot.

2. Make the object available for your script:

Qt Code:
  1. engine->globalObject().setProperty("myObject", engine->newQObject(myObject));
To copy to clipboard, switch view to plain text mode 

3. And use it this way in script:

Qt Code:
  1. myObject.setItemColor(255, 0, 0, 0);
To copy to clipboard, switch view to plain text mode