void BelowsEnh::paintBorder() { QPainter painter(this); painter.setWindow(0, 0, 100, 540); painter.setRenderHint(QPainter::HighQualityAntialiasing); QColor light = Qt::white; QColor dark = colBack.darker(140); painter.setPen(QPen(colBack, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad(5, 250, 10, 250); linGrad.setColorAt(0, light); linGrad.setColorAt(1, colBack); linGrad.setSpread(QGradient::PadSpread); painter.setBrush(linGrad); QRectF border(5, 5, 90, 530); painter.drawRoundRect(border, 30, 5); QLinearGradient linGrad1(85, 250, 95, 250); linGrad1.setColorAt(0, colBack); //linGrad1.setColorAt(1, dark); linGrad1.setSpread(QGradient::PadSpread); painter.setBrush(linGrad1); QRectF border1(20, 5, 75, 530); painter.drawRoundRect(border1, 30, 5); // paint label painter.setPen(QPen(colValue, 2)); QRectF Left(20, 505, 60, 20); //QRectF Right(55, 505, 25, 20); QFont valFont("Arial", 12, QFont::Bold); painter.setFont(valFont); painter.drawText(Left, Qt::AlignCenter, "Vent."); //painter.drawText(Right, Qt::AlignCenter, "R"); }
void VUMeter::paintBorder() { QPainter painter(this); painter.setWindow(0, 0, 50, 500); painter.setRenderHint(QPainter::HighQualityAntialiasing); QColor light = Qt::gray; QColor dark = colBack.darker(180); painter.setPen(QPen(colBack, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad(2, 250, 10, 250); linGrad.setColorAt(0, light); linGrad.setColorAt(1, colBack); linGrad.setSpread(QGradient::PadSpread); painter.setBrush(linGrad); QRectF border(2, 5, 48, 490); painter.drawRoundRect(border, 10, 3); QLinearGradient linGrad1(40, 250, 48, 250); linGrad1.setColorAt(0, colBack); linGrad1.setColorAt(1, dark); linGrad1.setSpread(QGradient::PadSpread); painter.setBrush(linGrad1); QRectF border1(25, 5, 23, 490); painter.drawRoundRect(border1, 10, 3); // paint label painter.setPen(QPen(colValue, 2)); QRectF channel(5, 450, 40, 40); QFont valFont("Arial", 20, QFont::Bold); painter.setFont(valFont); painter.drawText(channel, Qt::AlignCenter, label); }
void QPower::paintPowerOff() { QPainter painter(this); painter.setWindow(0, 0, 300, 200); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(QPen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad2(150, 50, 150, 175); linGrad2.setColorAt(0, Qt::darkGray); linGrad2.setColorAt(1, Qt::white); linGrad2.setSpread(QGradient::PadSpread); painter.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush(linGrad2); QRectF border2(40, 40, 220, 120); painter.drawRoundRect(border2, 20, 20); QLinearGradient linGrad1(30, 80, 150, 120); linGrad1.setColorAt(0, Qt::gray); linGrad1.setColorAt(1, Qt::white); linGrad1.setSpread(QGradient::ReflectSpread); painter.setBrush(linGrad1); QRectF border1(45, 45, 210, 110); painter.drawRoundRect(border1, 20, 20); painter.setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QRectF rect(120, 70, 60, 60); int startAngle = 115 * 16; int spanAngle = 310 * 16; painter.drawArc(rect, startAngle, spanAngle); painter.drawLine(150, 65, 150, 90); }
void Colorsel::paintBorder() { QPainter painter(this); painter.setWindow(0, 0, 200, 200); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(QPen(QColor(80, 80, 80), 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad1(10, 100, 15, 100); linGrad1.setColorAt(0, Qt::white); linGrad1.setColorAt(1, QColor(80, 80, 80)); linGrad1.setSpread(QGradient::PadSpread); painter.setBrush(linGrad1); QRectF border(10, 10, 180, 180); painter.drawRect(border); QLinearGradient linGrad2(190, 100, 195, 100); linGrad2.setColorAt(0, QColor(80, 80, 80)); linGrad2.setColorAt(1, Qt::black); linGrad2.setSpread(QGradient::PadSpread); painter.setBrush(linGrad2); QRectF border1(15, 10, 180, 180); painter.drawRect(border1); }
void VUMeter::drawBorder(QPainter *painter) { painter->save(); QColor light = Qt::white; QColor dark = colorBg.darker(140); painter->setPen(QPen(colorBg, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad(5, 250, 10, 250); linGrad.setColorAt(0, light); linGrad.setColorAt(1, colorBg); linGrad.setSpread(QGradient::PadSpread); painter->setBrush(linGrad); QRectF border(5, 5, 90, 530); painter->drawRoundRect(border, 30, 5); QLinearGradient linGrad1(85, 250, 95, 250); linGrad1.setColorAt(0, colorBg); linGrad1.setColorAt(1, dark); linGrad1.setSpread(QGradient::PadSpread); painter->setBrush(linGrad1); QRectF border1(20, 5, 75, 530); painter->drawRoundRect(border1, 30, 5); //绘制左右文字 painter->setPen(QPen(colorValue, 2)); QRectF Left(20, 505, 25, 20); QRectF Right(55, 505, 25, 20); QFont valFont("Arial", 12, QFont::Bold); painter->setFont(valFont); painter->drawText(Left, Qt::AlignCenter, "左"); painter->drawText(Right, Qt::AlignCenter, "右"); painter->restore(); }
void QPower::paintBorder() { QPainter painter(this); painter.setWindow(0, 0, 300, 200); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(QPen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient linGrad1(30, 100, 150, 100); linGrad1.setColorAt(0, Qt::gray); linGrad1.setColorAt(1, Qt::white); linGrad1.setSpread(QGradient::ReflectSpread); painter.setBrush(linGrad1); QRectF border1(20, 20, 260, 160); painter.drawRoundRect(border1, 20, 20); painter.setPen(QPen(Qt::black, 1, Qt::DotLine, Qt::RoundCap, Qt::RoundJoin)); QRectF border2(25, 25, 250, 150); painter.drawRoundRect(border2, 20, 20); }
void Colorsel::paintBar() { QPainter painter(this); painter.setWindow(0, 0, 200, 200); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush(Qt::black); QLinearGradient linGrad1(30, 90, 35, 90); linGrad1.setColorAt(0, Qt::gray); linGrad1.setColorAt(1, Qt::black); linGrad1.setSpread(QGradient::PadSpread); painter.setBrush(linGrad1); QRectF gradRect1(30, 30, 20, 127.5); painter.drawRect(gradRect1); QLinearGradient redGrad(40, 142.5, 40, 30); redGrad.setColorAt(0, Qt::red); redGrad.setColorAt(1, Qt::black); redGrad.setSpread(QGradient::PadSpread); painter.setOpacity(0.75); painter.setBrush(redGrad); QRectF red(30, 30, 20, redyp); painter.drawRect(red); QLinearGradient linGrad2(60, 90, 65, 90); linGrad2.setColorAt(0, Qt::gray); linGrad2.setColorAt(1, Qt::black); linGrad2.setSpread(QGradient::PadSpread); painter.setBrush(linGrad2); QRectF gradRect2(60, 30, 20, 127.5); painter.drawRect(gradRect2); QLinearGradient greenGrad(70, 142.5, 70, 30); greenGrad.setColorAt(0, Qt::green); greenGrad.setColorAt(1, Qt::black); greenGrad.setSpread(QGradient::PadSpread); painter.setOpacity(0.75); painter.setBrush(greenGrad); QRectF green(60, 30, 20, greenyp); painter.drawRect(green); QLinearGradient linGrad3(90, 90, 95, 90); linGrad3.setColorAt(0, Qt::gray); linGrad3.setColorAt(1, Qt::black); linGrad3.setSpread(QGradient::PadSpread); painter.setBrush(linGrad3); QRectF gradRect3(90, 30, 20, 127.5); painter.drawRect(gradRect3); QLinearGradient blueGrad(100, 142.5, 100, 30); blueGrad.setColorAt(0, Qt::blue); blueGrad.setColorAt(1, Qt::black); blueGrad.setSpread(QGradient::PadSpread); painter.setOpacity(0.75); painter.setBrush(blueGrad); QRectF blue(90, 30, 20, blueyp); painter.drawRect(blue); QLinearGradient linGrad4(120, 90, 125, 90); linGrad4.setColorAt(0, Qt::gray); linGrad4.setColorAt(1, Qt::black); linGrad4.setSpread(QGradient::PadSpread); painter.setBrush(linGrad4); QRectF gradRect4(120, 30, 20, 127.5); painter.drawRect(gradRect4); QLinearGradient opGrad(130, 142.5, 130, 30); opGrad.setColorAt(0, Qt::white); opGrad.setColorAt(1, Qt::black); opGrad.setSpread(QGradient::PadSpread); painter.setOpacity(0.75); painter.setBrush(opGrad); QRectF op(120, 30, 20, opyp); painter.drawRect(op); painter.setOpacity(1); QColor color(redY, greenY, blueY, opY); painter.setBrush(color); QRectF tot(150, 30, 30, 150.5); painter.drawRect(tot); }