#include #include #include #include #include class MyWidget : public QOpenGLWidget, protected QOpenGLFunctions { public: MyWidget(QWidget* parent = nullptr) : QOpenGLWidget(parent) { } protected: virtual void initializeGL() override { initializeOpenGLFunctions(); glClearColor(1.f, 0.5f, 1.f, 1.f); } virtual void paintGL() override { QPainter p(this); // p.beginNativePainting(); // // no need to put anything here to reproduce the bug // p.endNativePainting(); QPen pen(Qt::black, 4); p.setPen(pen); p.save(); p.translate(QPointF(800,-12)); p.rotate(35.7008); p.drawEllipse(QPointF(0,0), 245.051, 183.788); p.restore(); // without that last part, the bug does not occur pen.setDashPattern({5, 5}); p.setPen(pen); p.drawLine(QPointF(822,-155), QPointF(1220,131)); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MyWidget w; w.setGeometry(0, 0, 700, 700); w.show(); return a.exec(); }