How to force Redraw
-
You mean that TakeScreenShot() gets called in onVisibleChanged before the item is invisible ?
-
Can you show us the code after changes ?
-
Now that you have added it to MyItem you should call TakeScreenShot() there instead of onClicked handler as you did earlier
@
onVisibleChanged: {
if(!visible) {
obj.TakeScreenShot()
}
}
@This ensures that the item is invisible before taking the screenshot.
-
It's difficult to take the ScreenShot here because i don't want a screenshot at each visible change.
I will test anyway to investigate.
But i disagree on your ;sentence : 'This ensures that the item is invisible before taking the screenshot." . This ensure that the visible property is set to false regardless the repaint is done or not. -
I just made the test. The screenshot is taken when the Item is still visible.
It is clear that the event is fired when the property change. The repaint is done asynchronously.
I made a lot of search on internet and it seems there is no way to be notified of a repaint or to start a repaint manually. -
What is the Item that you are making invisible ?
I tested it with a Rectangle. It works as expected. Can you post a complete sample code which shows the problem ? -
According to the QQuickItem code "here":http://code.woboq.org/qt5/qtdeclarative/src/quick/items/qquickitem.cpp.html#_ZN17QQuickItemPrivate24setEffectiveVisibleRecurEb the signal visibleChanged() is emitted after the the item is made invisible; if I understood it correctly ;)