Draw ellipse with border. [SOLVED]
-
Hello guys, I am using this code to draw a circle.
@ QPainterPath circle_path;
circle_path.addEllipse(rect);
painter->drawPath(circle_path);@Is there anyway to fillup the circle with a color and draw its border with another color or I need two differents circle?
thanks -
It sets the pen and brush color to be used when painting, you still need to draw the ellipse:
@QPainterPath circle_path;
circle_path.addEllipse(rect);
painter->setPen(QColor(0x55, 0x55, 0xFF));
painter->setBrush(QColor(0xFF, 0x55, 0x55));
painter->drawPath(circle_path);@ -
@void mainWindow::paintEvent(QPaintEvent *)
{
QPainterPath circle_path;
circle_path.addEllipse(QRect(10,10,100,200));
QPainter painter(this);
painter.setPen(QPen(QColor(0x55, 0x55, 0xFF),20));
painter.setBrush(QColor(0xFF, 0x55, 0x55));
painter.drawPath(circle_path);}@
result:
!http://zalil.ru/33883490/379ff813.508767c0/ELLIPSE.png(RESULT)!Is this what you'd like to achive?
-
[quote author="terenty" date="1351009704"]
@void mainWindow::paintEvent(QPaintEvent *)
{
QPainterPath circle_path;
circle_path.addEllipse(QRect(10,10,100,200));
QPainter painter(this);
painter.setPen(QPen(QColor(0x55, 0x55, 0xFF),20));
painter.setBrush(QColor(0xFF, 0x55, 0x55));
painter.drawPath(circle_path);}@
result:
!http://zalil.ru/33883490/379ff813.508767c0/ELLIPSE.png(RESULT)!Is this what you'd like to achive?[/quote]
works like a charm. Sorry for the misunderstanding.