Qt Simulator Manual


The Qt Simulator JavaScript interface enables you to automate recurring sets of changes or to simulate a continuously changing environment.


Locating Scripts

Create a script (.js or .qs) that sets the device to its desired state when you open an application in Qt Simulator. Place the script in the scripts/autostart/ folder to run it automatically when Qt Simulator starts.

You can then use the Device Control dialog to change the default settings according to your test cases. To run the same tests repeatedly or to test complicated sequences of events, create scripts and place them in the scripts folder.

Place you favorite scripts in the scripts/favorites/ folder.

Example scripts are located in scripts/examples/.

To open the folder that contains the scripts in a file browser, select Open Folder.

Running Scripts

To run a script:

  1. Click the JS quick access button to bring up a list of scripts in the scripts/favorites/ folder.
  2. Double-click a script in the Scripting tab that shows the scripts in the scripts/ folder.
  3. Place a script in the scripts/autostart folder to run it when Qt Simulator starts.
  4. Add the -runscript <script file> parameter to a call of the Qt Simulator application on the command line to trigger the execution of a script in the currently running Qt Simulator instance externally.

The Active scripts field shows a list of currently active scripts. To pause or resume a script, select it and click Pause. To abort a script, select it and click Abort.

Function Reference

The following objects and functions are added to the common JavaScript global scope:

[Previous: Checking Application Layout] [Next: Adding New Device Models]


Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

s.parentNode.insertBefore(ga, s); })(); -->