Painting artefacts when using QPen with style other than SolidLine in QGraphicsView
Qt 4.6.0 (SDK for Windows with MinGW)
Hello!
Here is the minimum example:
mainwindow.cpp :
Code:
#include <QGraphicsView>
#include "mainwindow.h"
#include "myscene.h"
MainWindow
::MainWindow(QWidget *parent
){
MyScene* s = new MyScene(this);
s->setSceneRect(-1000,-1000,3000,3000);
setCentralWidget(v);
}
myscene.cpp:
Code:
#include <QGraphicsEllipseItem>
#include <QGraphicsSceneMouseEvent>
#include "myscene.h"
MyScene
::MyScene(QObject *parent
) :{
}
{
QRectF circleRect
(0,
0,
600,
600);
circleRect.moveCenter(e->scenePos());
el
->setPen
(QPen(Qt
::red,
4, Qt
::DashLine));
addItem(el);
}
main.cpp, myscene.h and mainwindow.h are the default as generated by QtCreator (except that I added mouseDoubleClickEvent declaration to myscene.h).
When I double click in the corner of the view, the ellipse appears (Only part of it fits in the view and that's OK), and when I scroll the view to the right, I see this:
http://i1.fastpic.ru/big/2010/0107/7...75b20a8375.jpg
If I use Qt::SolidLine, everything is fine, but with Qt::DashLine and all other styles I see this painting artefact.
Thanks in advance.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
and setting QGraphicsView::FullViewportUpdate didn't help...
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Please at least try it out, so I can know, is it seen on other platforms & compilers.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
I dont see any artifacts in there. Can you point out with a green arrow what you do not want to have?
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
The ellipse item is clipped.
It should be a full circle.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
What happens if you fill the ellipse with a brush. Does both the stroke and the fill get clipped?
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Everything is fine with the brush, but it didn't help to the pen ((
http://i1.fastpic.ru/big/2010/0109/6...ca8d24f16c.jpg
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Play around with different graphics subsystems, e.g. start your application with -graphicssystem raster or opengl and see whether there is a difference.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
With OpenGL it just crashed at startup
here is the callstack
0 atiPPHSN C:\WINDOWS\system32\atioglxx.dll 0 0x691e9dab
1 ?? 0 0x00000010
2 ?? 0 0x00000260
3 ?? 0 0x00000000
I never used OpenGL earlier, seems that there are certain problems with it on my system or I just didn't tune smth.
anyway I'm not interested in OpenGL, I need raster engine.
Can't u please compile that code and tell about the result ?
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Can you post a zip-file containing a minimal, compileable example? From what I see, your first example is not complete because MyScene is missing. Then I can try out on my mac.
1 Attachment(s)
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
1 Attachment(s)
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
I get painting artifacts when scrolling, see Screenshot. This looks like a bugreport. You should search in the bug database whether something similar was already reported. If not, open a new issue and describe in detail how to reproduce this. I had to look into the sourcecode to see that I need to doubleclick. Also I first thought that everyone was fine until I scrolled around by accident.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Seems like this is it
http://bugreports.qt.nokia.com/browse/QTBUG-6856
I wonder when they are going to release 4.6.1... don't want to download and build current branches <_<
Thanks!
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
You should try the current branch to see whether your problem is really fixed. Maybe it is something else and can be included in 4.6.1 if not covered by that fix mentioned in the bugtracker.
Re: Painting artefacts when using QPen with style other than SolidLine in QGraphicsVi
Yahoo! they assigned P2 to my bugreport. Rather quick response :) and it's not a duplicate.
http://bugreports.qt.nokia.com/browse/QTBUG-7253