#include #include class CustomWid : public QWidget { public: CustomWid() { setFixedSize(100,100); } protected: void paintEvent(QPaintEvent* evt){ qreal x = width() / 2.0; qreal y = height() / 2.0; QPainterPath path; path.moveTo(x - 1, y + 2); path.lineTo(x - 3, y - 1); path.lineTo(x - 7, y - 1); path.lineTo(x - 2, y + 6); path.lineTo(x + 1, y + 6); path.lineTo(x + 7, y - 6); path.lineTo(x + 3, y - 6); path.setFillRule(Qt::WindingFill); QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.fillPath(path, Qt::SolidPattern); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); CustomWid w; w.show(); return a.exec(); }