QPainter painter; painter.setBrush(QBrush(Qt::blue, Qt::SolidPattern)); painter.drawRect(50, 50, 200, 100);
QPainter painter; QRadialGradient gradient(100, 100, 50); gradient.setColorAt(0, Qt::white); gradient.setColorAt(1, Qt::black); painter.setBrush(gradient); painter.drawEllipse(50, 50, 100, 100);Package/Library: Qt Library.