Let's say that we want to perform a heavy calculation in C++ and access it from our QML calculator. We will choose factorial for this project.
Our goal is to inject our C++ class into the QML engine as a JavaScript object that will be available in our QML files. We will do that exactly like we did it in Chapter 10, Scripting. The main function creates a QQmlApplicationEngine object that inherits QJSEngine, so we have access to the API that is already familiar to us from that chapter. Here, we'll just show how we can apply this knowledge to our ...