Hello,

using QGraphicPathItems within a QGraphicsView with QGLWidget viewport I came across a strange memory consumption problem. It only happens when using a QGLWidget viewport and a DotLine or DashLine pen.

Here is a short code snipped:

Qt Code:
  1. MainWindow::MainWindow(QWidget *parent)
  2. : QMainWindow(parent), ui(new Ui::MainWindow)
  3. {
  4. ui->setupUi(this);
  5. QGraphicsView * view = this->findChild<QGraphicsView*>();
  6. view->setScene(new QGraphicsScene());
  7. view->setViewport(new QGLWidget());
  8.  
  9. pathItem->setPen(QPen(Qt::black, 1.0, Qt::DotLine));
  10. view->scene()->addItem(pathItem);
  11.  
  12. double i = 1000000.0;
  13. path.lineTo(i, -i);
  14. path.lineTo(-i, i);
  15. pathItem->setPath(path);
  16. }
To copy to clipboard, switch view to plain text mode 

I tried several configurations with and without QGLWidget, with and without a solid line.

Here are the memory consumption results:

QGLWidget, SolidLine, i = 1000000.0 : 19,3 MB
QGLWidget, SolidLine, i = 5000000.0 : 19,3 MB

no QGLWidget, DotLine, i = 1000000.0 : 13,4 MB
no QGLWidget, DotLine, i = 5000000.0 : 13,4 MB

QGLWidget, DotLine, i = 1000000.0 : 395 MB
QGLWidget, DotLine, i = 5000000.0 : 1,73 GB


Any I ideas how to handle this problem or what I can do to still use dotted paths within a QGLWidget viewport?


Thanks

Lodorot