Displaying errors on the status bar
First of all, there could be errors during the whole camera process and it's a good practice to make the user aware of what the error is. It can be done by a pop-up dialog and/or status bar. You don't want to alert the user to every trivial error. Therefore, it'd be better to use a pop-up dialog only for critical errors, while displaying non-critical errors and warnings on the status bar.
Qt began supporting the status bar a long time ago. The QStatusBar
class is the one that provides a horizontal bar suitable for presenting status information. The status of the camera can be displayed as well and it'll be introduced in later topics.
To use the status bar, edit mainwindow.ui
, right-click on MainWindow
, and select Create Status Bar if it doesn't exist or was previously removed.
Then, we should declare two slots to handle the camera and image capture errors, respectively. Add these two lines to private slots
in mainwindow.h
:
void onCameraError(); void onImageCaptureError...