基本上用QPainter就可以實現
1.
QPainter painter(this);
//開始的標志(可以不用)
painter.begin(this);
//保存最初的設置
painter.save();
//設置去鋸齒
painter.setRenderHint(QPainter::Antialiasing, true);
//設置畫筆形式(外側輪廓)
painter.setPen(QPen(QColor(79, 236, 190), 2));
//設置矩形區域
QRectF rectbutton = QRectF(1,1,82,82);
//繪制填充中間的顏色
painter.setBrush(QColor(191, 189, 189, 200));
//繪制橢圓
painter.drawEllipse(rectbutton);
//繪制“對號”
painter.setPen(QPen(QColor(79, 236, 190), 3));
painter.drawLine(QLine( QPoint(32.5*g_dscale, 41.0*g_dscale), QPoint(40.5*g_dscale, 50.0*g_dscale)));
painter.setPen(QPen(QColor(79, 236, 190), 3.5));
painter.drawLine(QLine( QPoint(40.5*g_dscale, 50.0*g_dscale), QPoint(57*g_dscale, 30*g_dscale)));
//最后更新(一定要)
update();
根本用不上傳入的參數,坐標系原點是控件的左上角;