qt5.jsx
Synopsis
Qt API wrapper for JSX.
This is a experimental version.
Motivation
It provides feature to create GUI in JSX.
Code Example
;;;;;;;;;;;;;;; var hourColor : QColor; var minuteColor : QColor; var hourHand : QPolygon; var minuteHand : QPolygon; { supernull Qt; thishourColor = 127 0 127 255; thisminuteColor = 0 127 127 191; thishourHand = 7 8 -7 8 0 -40; thisminuteHand = 7 8 -7 8 0 -70; this; thiswindowTitle = "Analog Clock"; this; } override : void { this; } override : void { var side = Math; var time = ; var painter = ; painter; painter; painter; painter; painter; painter; painter; painter; painter; painter; painter; painter; for var i = 0; i < 12; ++i painter; painter; painter; painter; painter; painter; painter; painter; painter; for var j = 0; j < 60; ++j if j % 5 != 0 painter; painter; painter; } static : void { var clock = ; var dialog = null null; var mainLayout = ; mainLayout; dialog; dialog; dialog; }
Installation
Setup Manually
- Install build Qt 5.2.0
Now prebuild interpreter for Windows needs mingw4.8 32 bit library.
- Prepare prebuild interpreter.
See: https://github.com/shibukawa/qtwidget.js/releases/
- Install JSX
npm install jsx
or sudo npm install -g jsx
.
- Comple your code and deploy
You can compile your code with the following command:
jsx --add-search-path qt5.jsx/src --executable node --output yourcode.js youcode.jsx
Compile your code and copy it as qtwidget.app/Content/Resources/js_src/main.js
(for mac) or js_src/main.js
(for windows).
Executable(qtwidget.app, qtwidget.exe) doesn't include needed dynamic frameworks/libraries. You should have to collect them. See these documents. macdeployqt
or windeployqt
will help you.
Recommended Process (future)
It recommends create application via jsx-init
$ npm install -g jsx-init$ jsx-init
It provides template to initialize application of qt.jsx.
After creating template, type the following command. It install all tools to build JSX:
$ npm install
Download runtime binary or build QtWidget runner and put it at the same folder. The following command creates .app file.
$ grunt build
Build Your own Interpreter
See development section.
API Reference
See doc folder and Qt 5.2 document.
Development
Repository
- Runtime: https://github.com/shibukawa/qtwidget.js
- QT Binding Generator: https://github.com/shibukawa/qtscriptgenerator
- Repository: https://github.com/shibukawa/qt5.js
- Issues: https://github.com/shibukawa/qt5.jsx/issues
Checkout qtwidget.js repository and run makebinding.sh
or makebinding.bat
then you will get JS to Qt binding and JSX to JS binding and document.
To add more class support, you should modify qtwidget/third_party/qtscriptgenerator/generator/typesytem_*
.
If you want to add more modules, you should add type system XML files and project files at qtwidget/third_party/qtscriptgenerator/qtbindings
.
Author
- shibukawa / yoshiki@shibu.jp
License
MIT
Complete license is written in LICENSE.md
.