PDA

View Full Version : Windows XP and QGraphicsView/Scene



maxpower
29th December 2006, 17:35
I am developing a simple game using Qt 4.2.2 and QGraphicsView/Scene. Everything works properly on Linux and on at least one Windows 2000 box. However, on several Windows XP boxes, the items in my send are not displayed properly. In order for them to display properly, I have to to switch to different window and then back again and the items appear. Sometimes items will show up on their own, but not often. Currently after I add my items I issue a scene-update() to, hopefully, repaint the scene. I have tried adding qApp->processEvents() before and after the update and while this sometimes provides a little more items to display, it is not 100% effective. If I call setViewport on the QGraphicsView to use QGlWidget, everything is displayed fine. I would rather not use OpenGL as it is much slower on both windows and linux. I can post code if neccessary but it is rather long so I would first like to see if anyone has any ideas. I have tried 4.2.0 and 4.2.1 with the same issue. I am using mingw. Is there any using in trying a 4.30 snapshot?

Thanks
mAx

wysota
29th December 2006, 17:55
Without seeing the code we won't be able to help you much. OpenGL is slower than a regular widget? Hmm.... do you have hardware acceleration in your gfx chip?

What would help is a minimal compilable example reproducing the problem - your own code is probably quite complex and pinpointing the exact reason of a faulty behaviour will be much easier with a simple snippet of code.

BTW. Have you tried running the application on a different WinXP box? There might be some extensions or tweaks in your system causing the incorrect behaviour...

maxpower
29th December 2006, 18:04
I can only test the OpenGL/Windows combo under VMware, so that is probably why it is slow. It is also slow in my linux laptop which has an integrated Intel chip with so-so performance. I have tried the program on different XP boxes, all with the same result. I will try to put together a simple demo that illustrates my problem. I should also note that the program works fund under Wine (which I believe is emulating win98).

Thanks
mAx

wysota
29th December 2006, 19:17
I guess you should test the app on a real XP box, after all, emulators are just emulators.

maxpower
29th December 2006, 19:39
Okay, here is an example. It is sort of different in that the items don't even show up if you switch windows. I tried this on a real XP box with the same results.

Thanks
mAx

Corran
30th December 2006, 01:20
Looking at your problem, I think it may well be related to mine (Possible QGraphicsView/Scene bug (http://www.qtcentre.org/forum/f-qt-programming-2/t-possible-qgraphicsviewscene-bug-5028.html)). I found that the items would only show up if the window was resized.
It's possible that it is a bug in a recent Qt version. I've had the problem on Qt 4.2.2 and KDE's svn qt-copy both under Linux. What versions were your executables built with?

Bitto
9th January 2007, 21:26
I think there's a bug in this GraphicsTest example. It doesn't add any items to the scene. The view is basically visualizing... nothing :-).

Bitto
9th January 2007, 21:34
My bad, I misread the example, items are indeed added.

The bug is that the items are added at positions like -4200000, 536, but the top-left corner of the scene is set to (0, 0). The defOffset variable, which is added to all X coordinates, seems to be uninitialized. Removing this variable, or setting it to 0, gives me rects and diamonds.