Update of QML view stops in 64bit Win7 for unknown reason (QDeclarativeItem::update() does not result in paint() call)
I work on a QML-based UI where some elements are implemented in C++ plugin. Everything works fine so far in WinXP 32bit and Win7 32bit, but there is a problem with Win7 64bit.
Sometimes on some machines application suddenly stops redrawing the view several seconds after start-up. Neither QML-initiated events (like MouseArea handlers), nor plug-in calls to QDeclarativeItem::update() work. In plug-in I am 100% sure that update() is called, but then I know, that calls to overriden QGraphicsItem::paint() do not happen as expected. The view only gets redrawn when window gets/loses focus. My assumption is that OS-initiated redraw is done correctly, while Qt event system gets stuck internally, but I was not able to prove that from debugger.
The problem is floating – sometime it happens quite persistently, sometimes it disappears. Behavior is not dependent on the code, as same code can run nicely on one machine, while freezing on the other.
Can someone help me out to understand what is going on there and what debugging strategy I can use to find out where the problem lays?
For technical details, we have QDeclarativeView placed inside a QDialog window. The view contains component from C++ plug-in, which is updated upon external event and shall be redrawn; normal user-initiated mouse events shall be handled as well. I don’t see anything extremely peculiar here.
Thank you in advance!
I have returned to this project after a break, and the problem persists. Anyone has good advice?
Adding qApp->processEvents() does not help.
What I think happens, is Qt's internal loop responsible for graphics scene update gets broken at some point, and quits to respond to internal update() request, while serving external requests such as WM_SETFOCUS and WM_KILLFOCUS on Windows. I really need Trolls' opinion because idea of debugging QGraphicsScene worries me :)
The only cause I could think of for this problem, was QDeclarativeItem::update() being called from non-Qt thread (callback coming from external DLL). I changed code to use Qt event loop via postEvent()/event() and for last day everything is alright for me. I shall test it more widely yet to make sure.