How to do it...

Let's get started by following these steps:

  1. Let's create a Qt Widgets Application project and open up mainwindow.ui.
  2. Drag and drop a PushButton from the Widget Box to the UI canvas:
  1. Right-click on the PushButton and select Go to slot. A window will appear:
  1. You will see a list of built-in slot functions available for the push button. Let's select the clicked() option and press OK. A slot function called on_pushButton_clicked() will now appear in both mainwindow.h and mainwindow.cpp. Qt Creator automatically added the slot ...

Get Qt5 C++ GUI Programming Cookbook - 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.