进度条组件 QT-RulerProgress
QT-RulerProgress 是一款基于 QT 框架开发的进度条组件,其特点是可以显示刻度标尺。该组件的源代码如下:
#include <QWidget>
#include <QPainter>
#include <QRectF>
class RulerProgress : public QWidget
{
Q_OBJECT
public:
explicit RulerProgress(QWidget *parent = 0);
void setValue(int value); //设置当前进度值
void setRange(int min, int max); //设置进度范围
void setOrientation(Qt::Orientation orientation); //设置方向,水平或垂直
protected:
void paintEvent(QPaintEvent *event) override;
private:
int m_value; //当前进度值
int m_min; //最小值
int m_max; //最大值
Qt::Orientation m_orientation; //方向
};
RulerProgress::RulerProgress(QWidget *parent) :
QWidget(parent),
m_value(0),
m_min(0),
m_max(100),
m_orientation(Qt::Horizontal)
{
}
void RulerProg
QT-RulerProgress是一款基于QT框架的进度条组件,特色在于能够显示刻度标尺,适用于需要清晰展示进度的场景。使用时只需包含头文件,创建RulerProgress对象并设置。
订阅专栏 解锁全文
348

被折叠的 条评论
为什么被折叠?



