I have the simple script below for testing purposes in a skeletal Qt project created with Qt Designer.

//Simple script
var myOne = sensors.accelerometerX;
var myTwo = sysinfo.generic.batteryLevel;
sysinfo.generic.batteryLevel = 50;
sensors.accelerometerX = 0.0;

The script runs but changing the last line to any non-zero value e.g,

sensors.accelerometerX = 0.1;

generates the following error displayed in the application output pane:-

X Error: BadAccess (attempt to access private resource denied) 10
Extension: 155 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x3c00013
QGLContext::makeCurrent(): Failed.

Any help will be appreciated. I am using Qt SDK 1.1.3 on Linux Ubuntu 11.04