void Knob::drawKnob(QPainter* p, const QRect& r) { const QPalette& pal = palette(); QRect aRect; aRect.setRect(r.x() + d_borderWidth, r.y() + d_borderWidth, r.width() - 2*d_borderWidth, r.height() - 2*d_borderWidth); int width = r.width(); int height = r.height(); int size = qMin(width, height); p->setRenderHint(QPainter::Antialiasing, true); // // draw the rim // QLinearGradient linearg(QPoint(r.x(),r.y()), QPoint(size, size)); linearg.setColorAt(1 - M_PI_4, d_faceColor.lighter(125)); linearg.setColorAt(M_PI_4, d_faceColor.darker(175)); p->setBrush(linearg); p->setPen(Qt::NoPen); p->drawEllipse(r.x(),r.y(),size,size); // // draw shiny surrounding // QPen pn; pn.setCapStyle(Qt::FlatCap); pn.setColor(d_shinyColor.lighter(l_const + fabs(value() * l_slope))); pn.setWidth(d_shineWidth * 2); p->setPen(pn); p->drawArc(aRect, 0, 360 * 16); // // draw button face // QRadialGradient gradient(size/2, size/2, size-d_borderWidth, size/2-d_borderWidth, size/2-d_borderWidth); gradient.setColorAt(0, d_curFaceColor.lighter(150)); gradient.setColorAt(1, d_curFaceColor.darker(150)); p->setBrush(gradient); p->setPen(Qt::NoPen); p->drawEllipse(aRect); // // draw marker // //drawMarker(p, d_angle, isEnabled() ? d_markerColor : Qt::gray); drawMarker(p, d_angle, pal.currentColorGroup() == QPalette::Disabled ? pal.color(QPalette::Disabled, QPalette::WindowText) : d_markerColor); }
void argexec() { ARG argp; while(is_loop && (argp = ctx->linearg ? linearg() : readarg(ctx->afd, ctx->arg_num))){ if(mtnexec(argp) == -1){ clrarg(argp); break; } clrarg(argp); } }