#ifndef MD_COMFORT_H
#define MD_COMFORT_H
#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
namespace Ui {
class MD_Comfort;
}
class MD_Comfort : public QWidget
{
Q_OBJECT
public:
explicit MD_Comfort(QWidget *parent = 0);
~MD_Comfort();
void set_MDC_RotateSpeed(int rotateSpeed);
void set_MDC_CarSpeed(int carSpeed);
protected:
/*
* 事件过滤器
*/
bool eventFilter(QObject *watched, QEvent *event);
/*
* 绘制转速表
*/
void draw_RotatetSpeed(int rotateSpeed);
/*
* 绘制转速
*/
void draw_CarSpeed(int carSpeed);
private:
Ui::MD_Comfort *ui;
int m_RotateSpeed = 0; //转速
int m_CarSpeed = 0; //车速
};
#endif // MD_COMFORT_H
---------------------
原文:https://www.cnblogs.com/liyanyan665/p/11304780.html