Help with flickering and slowly opening QDialog

I have created some terrible PyQt spaghetti and as a result my QDialog now opens very sluggishly and shows some annoying flickering as it does so. The reason isn’t clear to me but I image it will require rewriting large parts of my code.

I don’t except anyone to review my code. I only ask if anyone seen a similar effect of flickering - or something similar - along with very slow initialization of a QDialog and would have an idea of what kind of general mistake I’m making in my code right now (other than the ones I already suspect)?

In the screencast below, I click the Edit button, the flickering begins as the QDialog is initializing, and then eventually finishes. My suspicions:

  • I have a complicated setup of setting up initial values into inputs, dropdowns, combobuttons etc. and it looks like those are flickering into view initially?
  • Probably the initialization of one element is triggering a change-hook in another element and there’s multiple rounds of changes triggering other changes instead of all the initialization happening in one go all at once.

flickering_qdialog

If somebody is mad enough to want to look at about 2k lines of overly complex Qt code… this is the main definition of the QDialog, including already a couple subcomponents, the other big subcomponents being CopyFieldToFieldEditor and CopyFieldToVariableEditor.

Never experienced it, but maybe you could do some profiling with py-spy or line-profiler to search for problems.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.