qml: off-screen render DragItem to prevent flickering
-
grabToImage()
does not need an item to be visible. However,DragItem
needs to be visible for it to prepare itself to display. Normally, it should be ready after it is polished, but it has no support for that. -
x,y
should not be bound to the parent size because they are only necessary before it is set visible. (Unnecessary calculations) -
x,y
can be set before it is set to visible, but still it is hard to eliminate flickering becauseOverlay
size seems to be incorrect (which needs to be the window size), and directly accessing window size and settingx,y
still yields flickering in some conditions.
grabToImage()
already creates a layer, so we can justify creating a layer here. And by setting effect
to an empty Item
, the item will not be rendered in the main window.
Edited by Fatih Uzunoğlu