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.
The types of buttons supported are as follows:
The
push
buttonThe
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 the main function and later explain each callback separately to understand each one of them:
Mat img; bool applyGray=false; bool applyBlur=false; bool applySobel=false; … int main( int argc, const char** argv ) { // Read images img= imread("...