SDAA259 January   2026 AM623 , AM625 , AM625-Q1 , AM625SIP , AM62P , AM62P-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Detailed Description
    1. 2.1 Launching Qt Creator
    2. 2.2 Running The First Project on PC
    3. 2.3 Creating a Button
      1. 2.3.1 Modifying the Property of a Button
    4. 2.4 Creating a C++ Back-End Component
      1. 2.4.1 Defining the Scope of the Project
      2. 2.4.2 Connecting Your C++ Application to Your QML Application
    5. 2.5 Connecting to the EVM
    6. 2.6 Building and Deploying Your Application For Your Embedded Platform
      1. 2.6.1 Build the Application
      2. 2.6.2 Transfer Executable to the Board
    7. 2.7 Running the Application
  6. 3Summary
  7. 4References

Connecting Your C++ Application to Your QML Application

To connect the slots to the front-end, create an object in the main.cpp file. This object is going to be used in the qml file to call the functions defined in the back-end that was written.

 Connecting Slots to Your ObjectFigure 2-20 Connecting Slots to Your Object

Use the onClicked() function within the QML file to make the QT application aware that the application must do something when a button is clicked. In this case, call the C++ functions, blink(), on(), and off(), that were defined in the back-end.

 Calling C++ FunctionsFigure 2-21 Calling C++ Functions

Now when the user runs the application and clicks each of the three buttons in theWindow, the following results are shown in the terminal:

 Output of Each FunctionFigure 2-22 Output of Each Function