Adding buttons to a user interface

In the previous chapter, we learned how to create normal or QT interfaces and interact with them with a mouse and slider, but we can create different types of buttons as well.

Note

Buttons are only supported in QT Windows.

The types of buttons supported are as follows:

  • The push button
  • The checkbox
  • The radiobox

The buttons only appear in the control panel. The control panel is an independent window per program, where we can attach buttons and track bars.

To show the control panel, we can push the last toolbar button, right-click on any part of the QT window, and select the Display properties window or the Ctrl + P shortcut.

Let's see how to create a basic sample with buttons. The code is large, and we will first explain ...

Get OpenCV By Example 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.