PDA

View Full Version : Native vs Raster



ArlexBee-871RBO
13th February 2010, 14:57
Greetings,

Today I encountered a problem in my project (using Qt 4.6.0 under Linux), and later I noticed that setting the '-graphicssystem' option to 'raster' was the root cause. I also ran the diagramscene example with 'raster' setting to see if I get similar results because that part of my project is similar to the Qt example diagramscene.

Running diagramscene, if you create two items and connect an arrow from one to the other, and then move one of the items across and over the other, the arrow disappears. Moving the item will not bring the arrow back; you'll have to click on the item that you didn't move originally. This happens if you set the graphicssystem option to 'raster'. Setting it to 'native' works fine and the arrow doesn't disappear forever.

I have a very similar problem in my project. If I click on the item to initiate a line draw, but before connecting it to the next item, only a small portion of the line is drawn. The other end of the line right under the mouse pointer moves as it should, but it's not visible; only the end attached to the item is drawn. Again, this only happens in 'raster' mode, not 'native'.

I don't have to have it set to 'native', but it does appear to be little faster. At first I thought I was doing something wrong, till I tried the diagramscene demo in 'raster' mode. Does anyone know a fix to this problem other than not running in 'raster' mode? And can someone also explain this behavior?

axeljaeger
14th February 2010, 16:47
If you see differences between two different graphics backends, it is either a bug in your code or a bug in the graphcissystem. I tested the diagrammscene example here on my mac with both the native graphics backend and raster. I see the behaviour you describe that the arrow disappears in both of them when moving the arrow around. However, I think it is not a bug in the graphicssystem but in the graphicsview. See whether you can confirm what I observe:

I created two square objects a and b and connected them with a line. Lets say a is in the center of a clock and we move b around. Assuming that b is at 11 o'clock: When moving from 11 over the center to 4 o'clock, the arrow dissappears. When moving back along the same line, the arrow is shown again. When moving back in a circle shape clockwise or counter clockwise, the arrow appears again when passing 6/12 o'clock.

When moving around the clock, the arrow stays visible all the time.

ArlexBee-871RBO
14th February 2010, 21:52
What you described is what I was trying to explain; the arrow basically disappears when in raster mode.

The software rasterizer "is the reference implementation and the only paint engine that implements all possible feature combinations that QPainter offers." I find it hard to believe that the bug is in the raster implementation, but you never know. Also, I was under the impression that the raster mode is the default, but on my system it seems that the native mode is the default, which explains why I have never noticed this bug in diagramscene or in my project.

I can't verify that the bug is in the raster implementation, so I'm going to assume that the bug is in diagramscene. I'll be playing with it to see if I can get it fixed, which in turn might give me the fix for my project.

axeljaeger, could you also tell me your version of Qt?

axeljaeger
14th February 2010, 21:56
I used Qt-4.6.1 on a mac.

ArlexBee-871RBO
15th February 2010, 06:34
I fixed the bug in diagramscene. All I had to do was add this line to DiagramItem constructor:


setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);


Before that the DiagramItem::itemChange() wasn't getting called when moving an item.

I don't know why I thought this bug was only active when in raster mode. It is active in both, but the bug that I have is active only in raster mode.

axeljaeger
15th February 2010, 09:16
Probably this was a behaviour change between Qt 4.5 and 4.6. I read that they did something like this to improve performance. However, the example should be fixed then in the distribution also: May you write a bug report for that example?

ArlexBee-871RBO
15th February 2010, 22:17
Someone has already made a bug report: http://bugreports.qt.nokia.com/browse/QTBUG-7646
It's about two weeks old. I wonder if there is a better fix than what I have.

axeljaeger
15th February 2010, 22:22
You can vote for that bug or add a comment that you encounter the same problem.