[PyQt] Testing widget visibility
Grzegorz Bokota
g.bokota at mimuw.edu.pl
Mon Jan 20 12:52:38 GMT 2020
in my program I have widget which visibility which visibility is controlled
by some variable in internal settings object. In this case I meet verid bug
that it works on Linux (my main system) but does not work on Windows and
Macos. Due to this I would like to cover it with my test.
Control of this variable state is such that I cannot connect setVisible to
stateChanged of control Widget. But this change is done when widow with
widget is inactive.
My current code is
def event(self, event: QEvent):
if event.type() == QEvent.WindowActivate:
self.widget.setVisible(self.settings.control_variable)
return super().event(event)
And this works for all system (problem with multiple system were connected
with setting this variable), but when I try to test it using pytest and
pytest-qt the test fail because widget visibility does not change. I try to
use qtbot.waitActive and similar.
Anyone of you meet with such problem and can suggest how to write test
which allow to test changing widget visibility, when it changes on windows
activation?
Regards,
Grzegorz Bokota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200120/5f19f263/attachment.html>
More information about the PyQt
mailing list