I have 20 widgets that are updated not very fast. Only 2 of them are visible but paintEvent is called for all of them every time I change anything.
1) How can I check that a widget is visible / invisible to avoid slow drawing for invisible widgets?
2) How can I get a notification that a widget became visible/invisible?
Updated by Alex Fedorov over 2 years ago
I mean 'scrolled out of view'.
I have several widgets on my web-page. All of them are created using widgetset feature. Wingets are bent to DIV tags in HTML. In the widget constructor I added two lines:
Unfortunately onVisibilityChanged method is never called.
What am I doing wrong?
Updated by Korneel Dumon over 2 years ago
Regarding your use of widgetset, this will have an effect on this feature (the same would be true for any nested scrollable container).
The signal will trigger if the widget's position is inside the viewport , also if it is hidden beyond the boundaries of another scrollable container. Of course, this doesn't explain why you don't get any signal.
In the process of testing this, I discovered a small bug where I get 'signal not exposed' in the server log. If you get this, try moving the call to
setScrollVisibilityEnabled() to right after widget construction.