How to run a Qt application over the web (multiple access supported)

Running Qt application over the web
Picture of Leonardo Laurencio
Leonardo Laurencio

CSO - Cybele Software

Table of contents

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

Running a Qt app over the web

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();

Running a Qt app over the web

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.

Running a Qt app over the web

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

Running a Qt app over the web

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.

Running a Qt app over the web

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

Running a Qt app over the web

11. Save the file, and recompile your application again. And that’s it![/vc_column_text][/vc_column][/vc_row][vc_row full_width=”stretch_row” gap=”30″ equal_height=”yes” el_disable_desktop=”1″ el_class=”light-container”][vc_column][vc_empty_space height=”12″][vc_column_text]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

Running a Qt app over the web

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();

Running a Qt app over the web

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.

Running a Qt app over the web

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

Running a Qt app over the web

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.

Running a Qt app over the web

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

Running a Qt app over the web

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

Thinfinity_logo
Get a Free Trial
Explore Thinfinity Workspace risk-free. Test our Cloud Management and RPAM features for enhanced security and control.

Have any questions?

Book a call today to learn more about how Thinfinity® can help your organization. We are always available to guide you and provide the best solution based on your specific needs.

Add Comment

Thinfinity-blue-logo
Get a Demo
Experience how Universal ZTNA with Thinfinity integrates with VDI and DaaS for unmatched security and flexibility.
Thinfinity_logo

Get a Demo

Experience how Universal ZTNA with Thinfinity® integrates with VDI and DaaS for unmatched security and flexibility.

Blogs you might be interested in

<span>Application Modernization</span>, <span>HTML5 Conversion</span>, <span>Independent software Vendor (ISV)</span>, <span>Secure Application Delivery</span>, <span>Thinfinity VirtualUI</span>