It looks like you're new here. If you want to get involved, click one of these buttons!
Hi
Recently I found some of my old Py scripts that with custom Qt UI don't work correctly anymore.
some UI components will disappear once the user interacts with them, although a widget resizing can bring the object back, but it heavily impacts the experience.
is there any recommended way to solve this issue?
Thank you.
here's a short video of the issue I've encountered.
https://imgur.com/KBaMig1
the simple script I use for this demo is as below:
OS: Windows 11, (the script was originally tested and works fine on Windows 10)
import pya
class TestWidget(pya.QWidget):
def __init__(self, parent = None):
super(TestWidget, self).__init__()
self.layout = pya.QVBoxLayout()
self.combo1 = pya.QComboBox()
self.combo2 = pya.QComboBox()
self.layout.addWidget(self.combo1)
self.layout.addWidget(self.combo2)
for i in range(10):
self.combo1.addItem ("%d" % (i))
self.combo2.addItem ("%d" % (i))
self.setLayout(self.layout)
w = TestWidget(pya.Application.instance().main_window())
w.show()
Comments
Hi @RawrRanger,
thanks for the script, the problem is easy to reproduce.
And it's easy to fix: it one happens when the debugger is enabled. Problem is that with the debugger, the paint events are intercepted. As the debugger itself runs in Qt's event loop, interactions with the debugger may generate paint events which itself may invoke the debugger leading to infinite recursion or worse effects.
To get full UI experience run the script outside the debugger (bind it to a menu item for example) or disable the debugger.
Matthias
I disabled the debugger and now it works as intended.
Didn't thought about that and I was about to implement a force update on every click.