Introduction

To further extend the script engine functionality BrainStim has a feature that automatically detects and integrates (pre-generated) Qt bindings for the Qt Script environment. With these bindings you get access to substantial portions of the Qt API from within Qt Script. These script binding are automatically loaded from the shared libraries inside the Main Program Directory subfolder path /plugins/<architecture>/script directory during startup. These shared libraries include script binding for the Qt libraries: QtCore, QtGui, QtNetwork, QtWebkit, QtXml, QtXmlPatterns, QtSvg, QtSql, QtOpenGl and QtUiTools, see also the Qt Project Documentation. To turn of the auto-loading of Qt bindings for the Qt Script environment you can check the General/Skip automatic QT Script binding loading setting of the Settings Dialog.

Example

Let's test and make use a functionality of a loaded Qt Library Script binding.

This example makes use of the QColor and the QColorDialog class from the QtGui library which is made available in the scripting environment due to the automatic linkage to the Qt Bindings (qtscript_gui.dll), as explained above.
The script first constructs a QColor object. The passed parameter in the QColor constructor is used to preset the color. A static member function (getColor()) of the QColorDialog class is used to present to the user a color picking dialog allowing a selection of a custom color that is then copied to the QColor object. This color picking dialog prevents further script execution and gives the control back after the user accepted or rejected the color picking dialog.