Draws a filled-in circle : QPainter « Qt « C++






Draws a filled-in circle

  

#include <QtGui>

int main(int argc, char* argv[])
{
  QApplication app(argc, argv);
  QPixmap pm(100,100);
  pm.fill();

  QPainter p(&pm);
  p.setRenderHint(QPainter::Antialiasing, true);
  QPen pen(Qt::blue, 2);
  p.setPen(pen);
  QBrush brush(Qt::green);
  p.setBrush(brush);
  p.drawEllipse(10, 10, 80, 80);
  QLabel l;
  l.setPixmap(pm);
  l.show();
  return app.exec();
}

   
    
  








Related examples in the same category

1.Use QPainter to draw arc
2.Using QPainter to draw ellipse
3.Set pen and brush for QPainter
4.Set render hint to QPainter::Antialiasing
5.Renderer pattern
6.Linear Gradient
7.QLinearGradient and QPainter
8.Circle Widget with paint
9.Draw text
10.Matrix based translation
11.Paint picture
12.Paint rectangle
13.Painter
14.Painter path
15.svg viewer
16.Transformed Painter
17.Transformation demo
18.User-draw table
19.QConicalGradient