-
Book Overview & Buying
-
Table Of Contents
QT5 Blueprints
By :
Sometimes, we want a sort of indicator inside the status bar to display real-time status, such as the camera status. This is inappropriate if it's covered by temporary messages. In such a case, QStatusBar provides the insertPermanentWidget function to add a widget to the status bar permanently. It means that it won't be obscured by temporary messages and is located on the far right of the status bar.
Firstly, let's make a camera status widget. Add a new C++ class named CameraStatusWidget that inherits from QWidget, but use QLabel as the base class. We use QLabel as the base class because the status of the camera is displayed in text and is basically a customized label widget. The camerastatuswidget.h content is shown as follows:
#ifndef CAMERASTATUSWIDGET_H
#define CAMERASTATUSWIDGET_H
#include <QLabel>
#include <QCamera>
class CameraStatusWidget : public QLabel
{
Q_OBJECT
public:
explicit CameraStatusWidget(QWidget *parent = 0);
...
Change the font size
Change margin width
Change background colour