path->arcMoveTo(-innerWidth/2.0, -innerWidth/2.0, innerWidth, innerWidth, -45);
// drawing the first (outer) arc from -45 to 225 degrees (counter-clockwise)
path->arcTo(-innerWidth/2.0, -innerWidth/2.0, innerWidth, innerWidth, -45, 270);
path->arcMoveTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225);
// drawing the second (inner) arc from 225 to -45 degrees (clockwise)
path->arcTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225, -270);
path->lineTo(gradientTopRight); // line up to the first arc
path->closeSubpath();
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::red);
painter.
fillPath(*path,
QBrush(gradient
));
QPainterPath* path = new QPainterPath();
path->arcMoveTo(-innerWidth/2.0, -innerWidth/2.0, innerWidth, innerWidth, -45);
// drawing the first (outer) arc from -45 to 225 degrees (counter-clockwise)
path->arcTo(-innerWidth/2.0, -innerWidth/2.0, innerWidth, innerWidth, -45, 270);
path->arcMoveTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225);
// drawing the second (inner) arc from 225 to -45 degrees (clockwise)
path->arcTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225, -270);
path->lineTo(gradientTopRight); // line up to the first arc
path->closeSubpath();
QLinearGradient gradient(innerRect.topLeft(), innerRect.topRight());
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::red);
painter.fillPath(*path, QBrush(gradient));
To copy to clipboard, switch view to plain text mode
path->arcMoveTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225);
path->arcMoveTo(-innerWidth/2.0 + gradientPartThickness, -innerWidth/2.0 + gradientPartThickness, innerWidth - gradientPartThickness*2, innerWidth - gradientPartThickness*2, 225);
To copy to clipboard, switch view to plain text mode
wrote
Bookmarks