Running Qt programs in a browser
-
Hello
I am writing some simple structural analysis software using javascript and was looking for ways of attaching my programming to an open-source drawing program such as LibreCAD when I came across the Qt project which has all the tools I need for my scheme.
How do I run a 'Qt project' program? At present, I run everything in a chrome-browser and I send all my code results to a simple HTML line. Eventually, I want my programs on my phone. Would I be able to test my Qt code using a browser or will I have to use a viewer, please? Do I still use 'script' and '<link>' pointing to my code on an index page?
Regards
-
Hi,
Qt is a framework that uses 2 languages: C++ and QML. The QML engine is the part of Qt that understands JavaScript. (See "here":http://qt-project.org/doc/qt-5.1/qtdoc/qtquick-applicationdevelopers.html for an introduction to QML)
Web browsers don't understand C++ or QML code, so they can't run Qt programs. However, if you do your coding in the Qt Creator IDE, you can just click the "run" button and your program will start running.
To get started with Qt, download a Qt 5.1 SDK from http://qt-project.org/downloads and launch the Qt Creator IDE.
-
After I write my code, how do others execute it. Do I end up with an '.exe' type stand-alone program?
-
Yes, you build an .exe and distribute it with some DLLs.
-
i note that the Qt site quotes html5 and css. Am I able to manipulate the browser window using Qt executables. If so, what about the firewall. Does my 'participant' using a PC or phone have to download a dll or 'app'.
-
It really depends on your architecture. Can you describe your plan for "attaching my programming to an open-source drawing program such as LibreCAD"?
See http://qt-project.org/doc/qt-5.1/qtwebkit/qtwebkit-bridge.html for a detailed description on combining HTML 5 + CSS 3 + Qt. In summary, you have two choices:
- Web content in native applications
** Your user downloads the .exe and runs it on their PC/phone. The .exe can open websites that contain HTML5 content; the user doesn't need to use a web browser. - Thin clients
** Your user only needs to use their browser to open a website which acts as the GUI; the .exe runs on the server that hosts the website, and doesn't need to be downloaded by your user.
- Web content in native applications
-
My plan is to run some structural-design software from a browser. I key in the dimensions, javascript does the code and sends the results to the browser. Data will be stored in LocalStorage. The code will then manipulate a 2D drawing which I will mirror to the browser (like AutoLisp and AutoCAD). I have written most of the javascript code but did not want to reinvent the wheel for the 2D drawing and thought of plagiarising LibreCAD. I want the code to be small.
Thanks for the thin-client description; always wondered what it meant.
-
@cve60069 Did you accomplish what you set out to do? I'm interested in executing something similar with LibreCAD.