:1.227KB : :1 :2022-10-01 14:39:14
qt 圆形进度条(progress.cpp)如果开发者对于本文件有需要的可以参考。
void MyProgreessBar::paintEvent(QPaintEvent* event)
{
QPainter p(this);
QRect rc = rect();
p.setRenderHint(QPainter::Antialiasing);
int barWidget = 20;
int circleX = rc.width() / 2 ;
int circleY = rc.height() / 2;
int m_persent = 20;
int m_rotateAngle = 360 * m_persent / 100;
int allAngle = 360 * 100 / 100;
int side = qMin(rc.width(), rc.height());
QRectF outRect(0, 0, side, side);
QRectF inRect(barWidget, barWidget, side - 40, side - 40);
QString valueStr = QString("%1%").arg(QString::number(m_persent));
//画外圆
//p.setPen(Qt::NoPen);
//p.setBrush(QBrush(QColor(97, 117, 118)));
//p.drawEllipse(outRect);
//p.setBrush(QBrush(QColor(255, 107, 107)));
//p.drawPie(outRect, (90 - m_rotateAngle) * 16, m_rotateAngle * 16);
01-15VerticalProgressBar
12-06仿win8自定义ProgressBar
12-04progressbar进度条异步更新