Using dotted QPainterPath in QGLWidget leads to very high memory consumption
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:
Code:
MainWindow
::MainWindow(QWidget *parent
){
ui->setupUi(this);
pathItem
->setPen
(QPen(Qt
::black,
1.0, Qt
::DotLine));
view->scene()->addItem(pathItem);
double i = 1000000.0;
path.lineTo(i, -i);
path.lineTo(-i, i);
pathItem->setPath(path);
}
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