Running a Qt app over the web

Running a Qt app over the web

Qt is a modern cross-platform development framework with a single codebase providing common APIs across many platforms. When the web-version qt provides is not enough to take your desktop app to the web the way you planned, Thinfinity® VirtualUI can solve your needs. A typical example would be getting a Qt application accessed by multiple users on a web browser interface, thru different devices.

In this quick tutorial, we’ll show how to compile your QT application with VirtualUI, and take your application to the Web in no time.

Requirements:

a. Install Thinfinity® VirtualUI on the machine where QT is installed.
b. Download the Qt VirtualUI Demo example.
Below you’ll find the steps required to adapt your application with VirtualUI:
1. First we need to copy the “Thinfinity.VirtualUI.cpp” and “Thinfinity.VirtualUI.h” located in “C:\ProgramFiles\Thinfinity\VirtualUI\dev\c++” ( or “C:\ProgramFiles (x86)\Thinfinity\VirtualUI\dev\c++” if you are using the x32 bit version ) to the folder where the source of your application is located.
2. Add “Thinfinity.VirtualUI.cpp” as a file to the project.
3. If you are not linked to Shlwapi, then you need to add it to the project’s pro:
win32: LIBS += -lShlwapi


4. Add the following line to your main project, at the start of the execution:

#include "Thinfinity.VirtualUI.h"

In our example, this is located in “main.cpp”

5. Add the following lines right where the application starts, and before it enters the messages processing loop:

VirtualUI *vui = new VirtualUI();
vui->StdDialogs(true);
vui->Start();


6. Compile your application and the “Start in a new browser” message will be displayed.

7. When you press the ‘Start Web Browser’ button, a web browser will open pointing to the application. The application will also open in desktop mode.


8. Alternatively, choose to not show the message and observe on the Windows tray bar that the Thinfinity VirtualUI Development Server icon will appear.


9. If the application is not running in the debugger, it’s because the QT debugger is not listed as a valid debugger by Thinfinity VirtualUI.


10. In order to change this, we need to modify the “Thinfinity.VirtualUI.ini” inside the “\dev\bin32” or “\dev\bin64\” ( depending on the VirtualUI version, x32 or x64 bit ), and add the debugger to the list. In this case, we need to add “cbd.exe”:

[Debuggers]
FileNames=vfp6.exe,vfp7.exe,vfp8.exe,vfp9.exe,cdb.exe


11. Save the file, and recompile your application again. And that’s it!


    • Related Articles

    • How to run a Python development as web app

      Have a Python application and want to run it on the web? Thinfinity® VirtualUI is a windows software virtualization solution. By adding a piece of code to your Python app source you can then run it within a web browser and access it from any OS. Run ...
    • Run VB.Net software as a Web Application

      In this new article, we will show you how to adapt your Visual FoxPro code so you can run VB.Net developments in the cloud with Thinfinity VirtualUI. App example: https://www.cybelesoft.com/support/files/DemosVUI/VBNet.zip Bear in mind in this ...
    • How to take your Delphi application to the web

      Take your software written in Delphi to web, in minutes! In this article, we will show you how to adapt your Delphi application, Windows-based, so you can run it in the cloud (as if it was 100% HTML5) with Thinfinity VirtualUI. If you’re new to ...
    • Convert your Microsoft Access application to a Web Application

      Microsoft Access is a database management system (DBMS) from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. It is a member of the Microsoft Office suite of ...
    • How to take your VB6 application to the web

      While some discuss if Microsoft Visual Basic 6.0 is still active, we agree with Tim Anderson’s opinion (click here to read the full article): “VB will stick around for a while. It is still the macro language of Microsoft Office – and yes, this is ...