PDA

View Full Version : Caching of QPushButton embedded in QGraphicsScene



matthias_
26th March 2010, 11:43
Hi!

I have a QGraphicsScene that draws a fullscreen (video) image in the background. I use OpenGL for that.
On top of the video I am showing buttons and other widgets. I achieve that by embedding normal QWidgets as QGraphicsProxyWidgets. To speed up redrawing I enabled caching of those proxy widget items.
My problem is, that widgets like buttons which have several states (hover, pressed ...) are only cached once so I don't see mouse over effects. Invalidating the cache on every Mouse event doesn't seem to be a good solution performance-wise.
Does Qt offer any solution to that problem, or will I need to implement my own button class? I like the convenience of QGraphicsProxyWidgets together with StyleSheets, and wouldn't want to miss that.

Regards,
Matthias

aamer4yu
26th March 2010, 11:56
Does disabling caching meets ur speed requirements ?
If yes, then why go the longer way ;-)

matthias_
26th March 2010, 13:04
Well, it depends on the complexity of the style sheet involved. Border-images for instance seem to have a noticable impact on performance. But overall the performance is still good without caching buttons (while caching all other static widgets). Nevertheless more optimization would be nice and caching button states should not be hard to implement, I suppose.

Matthias

LMcBeath
1st October 2010, 20:31
Does disabling caching meets ur speed requirements ?
If yes, then why go the longer way ;-)

same problem as before but no disabling caching does not meet speed requirements

I have not had any luck in capturing the events to invalidate the cache either :(