Even though Qt 5 supports the signals and slots mechanism, some of the features in Qt 5 still use function callbacks, such as keyboard input, window resize, graphics painting, and others. Since these events only need to be implemented once, there is no need to use the signals and slots mechanism.
Function callbacks
How to do it...
Let's get started by following this example:
-
Create a Qt Widgets Application project, open up mainwindow.h, and add the following headers:
#include <QDebug>
#include <QResizeEvent>
#include <QKeyEvent>
#include <QMouseEvent>
- Then, declare these functions in mainwindow.h:
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void resizeEvent(QResizeEvent...