Time for action – Creating an event handler

Let's implement the last bit of functionality. When the user clicks on the Reset button, we should change the form's values. Go back to the form editor and right-click on the reset button in the Navigator or in the main area. Select Add New Signal Handler. Qt Creator will navigate to the corresponding implementation file (Calculator.qml) and display the Implement Signal Handler dialog. Select the clicked signal in the drop-down list and click on the OK button to confirm the operation. This operation will do two things:

  • The reset button will be automatically exported as a public property, just like we did it manually for the other controls
  • Qt Creator will create a boilerplate for the new signal ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.