Create circle using QPainter
Solved
General and Desktop
-
I found the following code which does exactly what I want it to do. However, The QPixmap is making it have a white square background instead of having the same color background as the window which is like gray. Is there anyway to display circle without the white background?
#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(); }
-
Thank you!!!