Calling C++ functions from JavaScript
In this recipe, we will learn how to put our knowledge to use and create a functional login screen using Qt and SQLite.
How to do it…
Let’s learn how to call C++ functions from JavaScript using the following steps:
- Create a Qt Widgets Application project. Open the project file (
.pro
) and add the following modules to the project:QT += core gui webenginewidgets
- Open
mainwindow.ui
and delete the mainToolBar, menuBar, and statusBar objects, as we don’t need any of these in this example program. - Add a vertical layout to the canvas, then select the canvas and click on the Lay Out Vertically button on top of the canvas. Add a text label to the top of the vertical layout and set its text to
Hello!
. Make its font bigger by setting itsstyleSheet
property as follows:font: 75 26pt "MS Shell Dlg 2";
This is what it looks like after we applied the font properties to our style sheet: