Scripting in Qt
-
Hello,
I want to develop an application based on Qt in which I need to provide graphical editor along with my application. This graphical editor will have collection standard and custom widgets which can be used to create one or multiple graphical interfaces. Now I want to consider some scripting language which can be used to manipulate properties of widget on an interface without compiling anything. Also scripting should support provision of implementing my own calls to collect data from database for an example.
Please suggest scripting option available with Qt and approach to achieve above mentioned functionality.
Thanks in Advance.
Best Regards,
Amit Golhani -
Hi @amit-golhani, and welcome to the Qt Dev Net!
What kind of GUI components do you need?
In terms of scripting, I think the most powerful technique is using QML. It incorporates JavaScript, so scripting is built-in. It might not have all the components you need though -- that's why I asked my previous quesstion.
-
Hello @JKSH, I am planning to develop an application package which will two major components related with GUI (1) Graphics building tool and (2) viewing tool for rendering graphics. I am not planning any 3D GUI as of now.
(1) Graphics building tool:I want to create Graphics building tool which can have collection of standard GUI components such as Layout, style management,widgets, dialogs, windows, drag and drop etc. as well as support for custom widgets or third part widgets. This will used by the user to create GUI as per their needs and GUI created using this tool will interact with RDBMS such as Oracle, MySQL to retrieve historical information if request by the user, also this GUI will interact with some module to display real-time values of the various parameters associated with application using shared memory or TCP/IP based communication. Since methods for retrieving real-time information and others will be proprietary, so we need to create custom libraries to retrieve information. Also we would like to provide functions available in the library to use in the scripts if required.
Considering above requirements I need your opinion to select scripting languages. Following are some key point which I am considering for deciding scripting option for my product:
-No or less programming knowledge required for using scripts since most of the scripts are created by the user
-No support for the pointer to avoid complexity and memory management handling by the user
-Should have mechanism to incorporate new or custom method defined in the custom libraries
-Should not use any complier to bind script with GUI component. Also user should require Qt license to use application and scripts
-Should support application without GUI that mean if required can run some business logic in the background
-Should use interpreter so that scripts can be changed any time without compiling project
-Should access all properties of GUI component to process or manipulate some business logic(2) Viewing tool:
Project created by GUI building tool may have single or multiple Frame or Dialog and using this tool it should be possible to render graphics. If required this tool can interpret scripts.
Please suggest options available in scripting to meet most of the requirement. Also suggest some approach to achieve desired functionality.
Best Regards,
Amit Golhani -
Hi @amit-golhani,
It almost sounds like you want to create your own GUI toolkit plus programming language. This is a very large project. I have not created something like this before, so I don't have the experience needed to offer you advice or suggestions.
However, I recommend you follow some QML + JavaScript tutorials and see if this fits your needs:
- http://doc.qt.io/qt-5/qml-tutorial.html
- http://doc.qt.io/qt-5/qml-advtutorial.html
- http://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html
-No or less programming knowledge required for using scripts since most of the scripts are created by the user
This is the most difficult requirement in your whole list. You want something that is very flexible to let your users to create custom logic, but yet you don't want your users to learn programming? This is a hard balancing act.
-No support for the pointer to avoid complexity and memory management handling by the user
-Should have mechanism to incorporate new or custom method defined in the custom libraries
-Should not use any complier to bind script with GUI component. ...
-Should support application without GUI that mean if required can run some business logic in the background
-Should use interpreter so that scripts can be changed any time without compiling project
-Should access all properties of GUI component to process or manipulate some business logicMost scripting languages can provide these.
Also user should require Qt license to use application and scripts
Why?
-
If you want make application with drag-and-drop, operating with DB, scripting to operate with widgets on the forms, store and load widgets in UI files, change forms without recompile of the project, take a look at QtRptDocumentDemo