Search code examples
qtqtscript

what does "Making Applications Scriptable" mean and when should we use it?


Recently I noticed some classes in Qt which is called Qt script module and according to documentation it's used to make an application scriptable! here is my questions :

  1. What does it mean? making an application Scriptable?
  2. And when should we use it?

Thanks in advance


Solution

  • What scripting is
    ~~~~~~~~~~~~~~~~~
    Most of the super huge s/w come with lots of features. And quiet interestingly many of the new features that are added are the combinations of basic existing features. But one cant keep on adding new C++ code to create a simple feature...they can just write a script interactively which performs the existing operations in a tandem process and does the job of new feature.

    Best examples..Blender(Python scripting). If can look in this scenario.. Blender has 1000s of features. Most of them are actually scripted features calling the existing features in an orderly fashion.

    QtScript
    ~~~~~~~~
    This module of Qt framework provides a javascript interpreter(Google v8 js engine) at your disposal. You can call your QObject classes and related methods from javascript as it they were native functions of js(Only in you application). QScriptable classes expose the internals of your c++ QObject's properties and methods to javascript engine.

    When To USe
    ~~~~~~~~~~~
    When you have a huge application with lots of modules, and you want to retain the programmability of your application even after compiling it into machine code, then you have to use scripting.